duck Posted September 11, 2013 Share Posted September 11, 2013 hello all i hope sombody can help me with this. i got a XML file wich got this tag init <SONGTITLE>10CC - I Took You Home</SONGTITLE> so itsthe meaning that i get the artist and the songtitle seperate to go into this line echo LastFMArtwork::getArtwork('artist', 'title', true, "medium"); could sombody pls tell me how to do this Quote Link to comment https://forums.phpfreaks.com/topic/282070-xml-explode/ Share on other sites More sharing options...
trq Posted September 11, 2013 Share Posted September 11, 2013 simple_xml. Quote Link to comment https://forums.phpfreaks.com/topic/282070-xml-explode/#findComment-1449114 Share on other sites More sharing options...
duck Posted September 11, 2013 Author Share Posted September 11, 2013 ty for that , but i bin looking there for 3 days and stil got no clue what happens after i exploded it (nameof it then??) could you pls point me to the page i need atleast Quote Link to comment https://forums.phpfreaks.com/topic/282070-xml-explode/#findComment-1449115 Share on other sites More sharing options...
vinny42 Posted September 11, 2013 Share Posted September 11, 2013 He did, follow the link and read it. Quote Link to comment https://forums.phpfreaks.com/topic/282070-xml-explode/#findComment-1449130 Share on other sites More sharing options...
duck Posted September 11, 2013 Author Share Posted September 11, 2013 oke , i gues ime in the wrong place here , sry for the stupid question , gonna go look if i can find a forum for beginners Quote Link to comment https://forums.phpfreaks.com/topic/282070-xml-explode/#findComment-1449131 Share on other sites More sharing options...
Irate Posted September 11, 2013 Share Posted September 11, 2013 <?php $xml = simplexml_load_file("path/to/file/file.xml"); $res = $xml::xpath("//SONGTITLE"); echo "<pre>"; print_r($res); echo "</pre>"; ?> Try that. Quote Link to comment https://forums.phpfreaks.com/topic/282070-xml-explode/#findComment-1449142 Share on other sites More sharing options...
duck Posted September 11, 2013 Author Share Posted September 11, 2013 that actualy just returns me the string Array ( [0] => SimpleXMLElement Object ( [0] => Jennifer Lopez - Dance Again ) ) wich i could get alot easyer with just this i think : echo $xml->SONGTITLE." "; but thats not my question at all . what ime asking is how to get the artist and songtitle seperate and then how to use them . Quote Link to comment https://forums.phpfreaks.com/topic/282070-xml-explode/#findComment-1449157 Share on other sites More sharing options...
duck Posted September 11, 2013 Author Share Posted September 11, 2013 i found how to do it , ty for those that tryd $songChunks = explode("-", $xml->SONGTITLE); print " $songChunks[0]<br />"; print " $songChunks[1]<br />"; Quote Link to comment https://forums.phpfreaks.com/topic/282070-xml-explode/#findComment-1449164 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.