Jump to content


Photo

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


  • Please log in to reply
2 replies to this topic

#1 arianhojat

arianhojat
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 16 October 2006 - 03:24 PM

i tried something like this...

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

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

#2 rune_sm

rune_sm
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 16 October 2006 - 03:38 PM

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



#3 arianhojat

arianhojat
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 16 October 2006 - 06:22 PM

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?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users