annihilate Posted March 5, 2006 Share Posted March 5, 2006 Hello, I am trying to retrieve some data from an XML file and I am using some code from [a href=\"http://www.zend.com/zend/spotlight/code-gallery-wade6.php\" target=\"_blank\"]here[/a] to do it. The problem I am having is how to get the 'date uts' value, in the example below it is 1141249715. The other values I can get ok using $_item['URL'] for example, and $_item['DATE'] gets me the Mar 1, 2006 bit. [code]<track> <artist mbid="665e63e9-cf0c-49c7-b98d-0d42ff9c50de">The Jimi Hendrix Experience</artist> <name>In From The Storm</name> <mbid /> <url>http://www.last.fm/music/The+Jimi+Hendrix+Experience/_/In+From+The+Storm</url> <date uts="1141249715">Mar 1, 2006, 21:48</date> </track>[/code]The alternative I suppose would be to convert the Mar 1, 2006 bit into a timestamp, but seems overkill when there is already a timestamp there, I just can't work out how to access it!Thanks Quote Link to comment https://forums.phpfreaks.com/topic/4118-get-date-from-an-xml-file/ Share on other sites More sharing options...
wickning1 Posted March 5, 2006 Share Posted March 5, 2006 Dude, I knew you could pick up chicks in an XML file!Seriously though, after reading through that website it seems that the code posted there does not support extracting those tags. I haven't had to parse XML with PHP yet but I may investigate and see if I can be of more help later. Quote Link to comment https://forums.phpfreaks.com/topic/4118-get-date-from-an-xml-file/#findComment-14314 Share on other sites More sharing options...
jajtiii Posted March 5, 2006 Share Posted March 5, 2006 Use the SimpleXML object/library. Zend should have some tutorials on that as well.If the xml is well-formed, it will give you an easy way to extract whatever you want. Quote Link to comment https://forums.phpfreaks.com/topic/4118-get-date-from-an-xml-file/#findComment-14321 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.