I have a small problem with a script that reads an XML file and prints the output:
<?php
$doc = new DOMDocument();
$doc->load("http://www.tripadvisor.it/Feeds-d235955-treviews.xml");
foreach ($doc->getElementsByTagName('item') as $node) {
echo $node->getElementsByTagName('title')->item(0)->nodeValue;
echo $node->getElementsByTagName('description')->item(0)->nodeValue;
echo $node->getElementsByTagName('link')->item(0)->nodeValue;
echo $node->getElementsByTagName('pubDate')->item(0)->nodeValue;
}
?>
If you use this script on my personal domain (hosting) it works fine, but if I use on my VPS does not work and returns these errors:
Warning: DOMDocument::load(http://www.tripadvisor.it/Feeds-d235955-treviews.xml) [domdocument.load]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/AAA/public_html/test.php on line 4
Warning: DOMDocument::load() [domdocument.load]: I/O warning : failed to load external entity "http://www.tripadvisor.it/Feeds-d235955-treviews.xml" in /home/AAA/public_html/test.php on line 4
Which PHP or APACHE settings that may cause problems?