Page 1 of 1

Converting external XMl source into something meaningful

Posted: Tue Apr 20, 2004 5:01 am
by Nunners
Hi Folks,

I think I need a bit of pointing somewhere to work out how to do this....

I've got a URL: http://tawl.holiday.co.uk/EntryPoints/T ... EB46418DB9

And I want to turn into into something meaning - preferably some PHP variables with which I can display the info....

Looking around, and from previous expereince, I'm trying to use PEAR.... CAn someone give me an idea which package I need to use, as most of them seem only to deal with XML outwards, not inwards - if that makes sense?!?!?!

Cheers
Nunenrs

Posted: Tue Apr 20, 2004 5:46 am
by Nunners
Here is a reply I got from another source should anyone ever need it....
Thanks for the info... I've finally got somewhere!!!

I've now got an echo of the array dump of the XML file - which I hadn't up to now! However, that's of a static file, saved on the server. How do I do it so that I can get an external source.... again I'm guessing a PEAR package is useful here, and I've tried using HTTP_REQUEST.... is that correct...

Oh... and the next step will be it needs to be cached, to save on download time - any help with that would be great :) :) :) :)

Here's the code so far...:

require_once 'XML/Unserializer.php';
$options = array(
"parseAttributes" => true,
"attributesArray" => false
);
$unserializer = &new XML_Unserializer($options);
$status = $unserializer->unserialize('test.xml', true);
if (PEAR::isError($status)) {
echo "Error: " . $status->getMessage();
} else {
$data = $unserializer->getUnserializedData();
echo "<pre>";
print_r( $data );
echo "</pre>";
}

Cheers
Nunners