ziltech Posted January 3, 2008 Share Posted January 3, 2008 Hello All, Probably a very easy question from a PHP novice. I am trying to find out how to write a php script that can assign an element from an XML file to a PHP variable. The XML source is http://www.avallen.co.uk/scr/auth/v3main/txtvrm/reg.php?strVRM=wlo6kcu Note that the XML is dynamically generated from the reg.php file, it isn't a direct source to a static XML file. I want to just be able to assign the 'ErrorDescription' element of the XML file to lets say an $errordescription variable so that I can easily echo it anywhere on the php page. Probably very simply but scratching my head. Thanks very much, Rob Quote Link to comment https://forums.phpfreaks.com/topic/84359-solved-view-this-xml-data/ Share on other sites More sharing options...
Barand Posted January 4, 2008 Share Posted January 4, 2008 try <?php $xml = simplexml_load_file("http://www.avallen.co.uk/scr/auth/v3main/txtvrm/reg.php?strVRM=wlo6kcu"); $errDesc = (string)$xml->DataArea->Error->Details->ErrorDescription; echo $errDesc; ?> Quote Link to comment https://forums.phpfreaks.com/topic/84359-solved-view-this-xml-data/#findComment-429817 Share on other sites More sharing options...
ziltech Posted January 4, 2008 Author Share Posted January 4, 2008 Genius, This is perfect - thanks very much! Quote Link to comment https://forums.phpfreaks.com/topic/84359-solved-view-this-xml-data/#findComment-429820 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.