URL file-access and SimpleXML

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
stefano22
Forum Newbie
Posts: 1
Joined: Mon Oct 23, 2006 6:16 am

URL file-access and SimpleXML

Post by stefano22 »

For a project I am working on I need to get data from freedb2.org. The easiest way will probably be to use the xml feeds they provide.

I have tried to use php's simplexml function but of course I can't use:

Code: Select all

include 'http://www.freedb2.org/xml/whatever';

$xml = new SimpleXMLElement($xmlstr);
because I get this error

Code: Select all

URL file-access is disabled in the server configuration
The same is also true for:

Code: Select all

simplexml_load_file('http://www.freedb2.org/xml/whatever');
I have found a horrid way of getting it working use curl.

Is there a better way of doing this?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: URL file-access and SimpleXML

Post by volka »

stefano22 wrote:I have tried to use php's simplexml function but of course I can't use:

Code: Select all

include 'http://www.freedb2.org/xml/whatever';

$xml = new SimpleXMLElement($xmlstr);
because I get this error

Code: Select all

URL file-access is disabled in the server configuration
not "of course" but because of the server's configuration, see http://de2.php.net/manual/en/ref.filesy ... -url-fopen

btw: Where would $xmlstr come from in your first example? Does http://www.freedb2.org/xml/whatever return valid php code? I doubt it.
Post Reply