Jump to content

Archived

This topic is now archived and is closed to further replies.

arianhojat

loading dynamic xml (created from a php file) into php (w. simplexml_load)

Recommended Posts

i tried something like this...

[code]$xml = simplexml_load_file('dynamicXML.php') or die ("Unable to load XML file!");
$yearEnd = $xml->someNode;[/code]

i get a 'Unable to load XML file'. yet going to dynamicXML.php in my web browser returns a good xml result. any ideas? tried searching for loading dynamic xml into php, but couldnt find any articles suprisingly, is simplexml the way to go here? or do i have to serialize(dynamicXML.php) it into a variable before loading it with simplexml?

Thanks in advance,
Arian

Share this post


Link to post
Share on other sites
You have to use the load_string command if it's not an XML file.... Take a look at the example at the php.net site:

http://dk2.php.net/simplexml

Share this post


Link to post
Share on other sites
Hey rune_sm,
is this still the case when the webpage has a header of text/xml?
can i just pass the php filename to load_string?
or do i have to do any special functions on the file, somehow convert it to soemthing liek a file_get_contents be4hand?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.