I'm having an issue with my PHP assignment for school. I have to create a PHP script that reads an XML file with bunch of URLs to different RSS feeds. I'm using DOMDocument to retrieve an URL from this XML file and load a new DOM with the RSS feed. I assign the "url" node value to $url and then create a new DOM object for the RSS feed using $url.
$url = $student->getElementsByTagName("url");
$url = $url->item(0)->nodeValue;
$rss = new DOMDocument();
$rss->load($url);
The RSS file will not load when I use the code above. I even echoed $url to make sure that it has a link assigned to it. However, if I put the actual url into the load(), it works just fine. Why isn't $url working in load()?
You can use
simplexml_load_file
in this case, but remember, all these operations are costly (time limit, memory etc..).UPDATE