PHP SimpleXML load file not working with URL source

Posted on 2008-10-08
Medium Priority
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(http://www.mcqnet.net/files/test.xml) [function.simplexml-load-file]: failed to open stream: No such file or directory
$xml = simplexml_load_file('http://www.mcqnet.net/files/test.xml');

Open in new window

Question by:billymcqueary
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Accepted Solution

Lordgobbledegook earned 1500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

770 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