Solved

PHP SimpleXML load file not working with URL source

Posted on 2008-10-08
4
2,819 Views
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

0
Comment
Question by:billymcqueary
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
Lordgobbledegook earned 375 total points
Comment Utility
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.
0
 

Author Comment

by:billymcqueary
Comment Utility
Lordgobble,
What version of PHP are you running?

0
 
LVL 4

Expert Comment

by:Lordgobbledegook
Comment Utility
PHP 5.24

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

Author Comment

by:billymcqueary
Comment Utility
I think I may have discovered the problem.  I will report back on that.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now