Hello I have recently been using the php function, simplexml_load_file() in order to load an xml file and then display it. It was working perfectly until yesterday when it told me that my php server couldn't find the feed anymore. Here is the code and the resulting error message

    
$xml = simplexml_load_file('http://feeds.feedburner.com/ace-bdf'); print_r($xml);
Warning: simplexml_load_file(http://feeds.feedburner.com/ace-bdf) [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\Program Files\XAMPP\xampp\htdocs\xampp\test\xmlfeed\index2.php on line 17

Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://feeds.feedburner.com/ace-bdf" in C:\Program Files\XAMPP\xampp\htdocs\xampp\test\xmlfeed\index2.php on line 17

This problem is extremely confusing because I can navigate to the feed (http://feeds.feedburner.com/ace-bdf) with my web browser without any problems. Also it was working perfectly a few days ago but stopped working even though I made zero modifications to the script.

Any help would be greatly appreciated.

    Your code is working fine for me.
    I think this is a php version issue. what is version? if version is less than version 5.1.0, then u should use urlencode or rawurlencode. hope this will solve the problem.

      Thanks for the reply. I have PHP version 5.21 on my server here so I'm pretty sure thats not the problem but I tried it anyway with no luck 🙁

      EDIT: Are you saying you copied and pasted that exact code with that feed and it worked for you?

        yes. I have the version 5.2.5. and it works fine.

          Hi Tapos

          I had the same issue once and the reason was that the host denied access to the file. Maybe contact the host and ask if this is the case with this feed.

            Looks like they return a 302 and then 404 response if you try to request the feed without a common User-Agent string. Imitating FireFox, I was able to get the feed just fine.

            As such, they're probably trying to prevent everyday scripts from grabbing their XML data. Have you perhaps tried looking into using their API?

              Write a Reply...