PHP SimpleXML load file not working with URL source

Posted on 2008-10-08
Last Modified: 2012-08-14
I am trying to load an xml file from a remote URL.  The code below works just fine when I point to a local file.  However when I use a remote file I get the following error.  Is there some sort of encoding or datatype change I need to do when passing in a URL instead of a local file?

simplexml_load_file( [function.simplexml-load-file]: failed to open stream: No such file or directory
$xml = simplexml_load_file('');

Open in new window

Question by:billymcqueary
  • 2
  • 2

Accepted Solution

Lordgobbledegook earned 375 total points
ID: 22669184
You code exactly as above works fine at my end.  It appears that the problem does not lie with your code. I hope this helps somewhat.

Author Comment

ID: 22669303
What version of PHP are you running?


Expert Comment

ID: 22669389
PHP 5.24

I am not sure off hand if it affects simplexml_load_file, but allow_url_fopen is On.

Author Comment

ID: 22669652
I think I may have discovered the problem.  I will report back on that.

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question