Parsing a sitemap
I am still relatively new to PHP, and I can't seem to come up with a code to parse a sitemap and find all the content between <loc>and</loc> tags. I tried using DOM using a snipit I found, but my server doesn't support it.
any ideas for reading all the <loc>content here</loc> into an array?
Your server has DOM disabled? Why? Can you enable it? Or is this a shared host? Why would your hosting company have DOM disabled?
You could use fsockopen() to get the contents of the page and then use regex to find the tag you're interested in... or perhaps even use simpleXMLelement to parse the page and find the tag using that object's methods. Not really sure that would work.
You could use the following regular expression.
$pattern = '#<loc>[^<]+</loc>#si';
if (preg_match_all($pattern, $text, $m))
$locs = $m;