' Http://box.zhangmen.baidu.com/x?op=12&count=1&title= in the winter $$ Qi Qin $ $ '
This interface provides XML-formatted files, which I use $xml = file_get_contents (' http://box.zhangmen.baidu.com/x?op=12&count=1&title= about in winter $$ Qi Qin $ $ '); How to get the value inside the XML, ask PHP God to write some of the code for my reference, thank you very much.
$xml = file_get_contents (' http://box.zhangmen.baidu.com/x?op=12&count=1&title= in the winter $$ Qi Qin $ $ '); $result = simplexml_load_string ($xml);
Print results
Object (SimpleXMLElement) [1] public ' count ' = = String ' 1 ' (length=1) public ' url ' = = object (simplexmlelement) [2 ] public ' encode ' = = Object (simplexmlelement) [5] public ' decode ' = Object (simplexmlelemen t) [6] public ' type ' = ' + string ' 8 ' (length=1) public ' lrcid ' = = String ' 14706 ' (length=5) public ' flag ' = = String ' 1 ' (length=1) public ' durl ' = = Object (simplexmlelement) [3] public ' encode ' = Obje CT (simplexmlelement) [7] public ' decode ' = = Object (simplexmlelement) [8] public ' type ' = = String ' 8 ' (length=1) Public ' lrcid ' + string ' 14706 ' (length=5) public ' flag ' = = String ' 1 ' (length=1) public ' P2 P ' = = object (simplexmlelement) [4] public ' hash ' = = String ' d1cae9f7634c5aa3d54d7b1b1ad4c5b79b6e97ff ' (lengt h=40) public ' url ' = = object (simplexmlelement) [9] public ' type ' = = String ' mp3 ' (length=3) PU Blic ' size ' = = string ' 5710896 ' (length=7) public ' bitrate ' = ' = String ' 192 ' (length=3)
I want to take
http://zhangmenshiting.baidu.com/data2/music/64380827/Z2ZmbGVuaW9fn6NndK6ap5WXcGhomGieaZSZaGpvmGxlY2tnZ5ebaWNpamaaaZlrk2lqmZaXa3CTZJeZmW1ncGVll1qin5t1YWBkbGVpb2tiZGxqZ2drajE$
64380827.mp3?xcode=43b1f8bf459a441832ad12772e3b3b77eaa48b2ded70843d&mid=0.18038312962142
Encode the data inside. What should I do, the value of that object (SimpleXMLElement) [5] is taken out.
Reply to discussion (solution)
$xml = file_get_contents (' http://box.zhangmen.baidu.com/x?op=12&count=1&title= in the winter $$ Qi Qin $ $ '); $result = simplexml_load_string ($xml, ' simplexmlelement ', libxml_nocdata); Var_dump ($result->url->decode);
$xml = file_get_contents (' http://box.zhangmen.baidu.com/x?op=12&count=1&title= in the winter $$ Qi Qin $ $ '); $result = Simplexml_load_string ($xml, ' simplexmlelement ', libxml_nocdata); $ret = (array) $result->url;echo $ret [' encode ']. "
"Echo $ret [' decode '];
http://zhangmenshiting.baidu.com/data2/music/64380827/ Z2zmbgvuaw9fn6nndk6ap5wxcjztb5lsamrjaw2znjmtawxrawmycwdoa2drz26zazhlmzaxa3ctzjezmw1ncgvll1qin5t1ywbmbwlvchflzmxqawttbde $
64380827.mp3?xcode=b89b492058ceab79743a96683617a8f2eaa48b2ded70843d&mid=0.39499944964564
XML = file_get_contents (' http://box.zhangmen.baidu.com/x?op=12&count=1&title= in winter $$ Qi Qin $ $ '); $result = Simplexml_load_string ($xml); Echo strval ($result->url->encode); Echo strval ($result->url->decode);
http://zhangmenshiting.baidu.com/data2/music/64380827/ Z2zmbgvuaw9fn6nndk6ap5wxcgvpzpuazjdrbgtqmm1my2lolppnmpsxzwzubzyclmlmmzaxa3ctzjezmw1ncgvll1qin5t1ywbmbgxsamxlagvrbg9tate $64380827.mp3?xcode=140db3e8864c55164ad0bce2297ede73eaa48b2ded70843d&mid=0.38763446277961
Baidu knows that there have been someone to answer, with the implementation of the DOM, the feeling is not easy for you to write. Because I do not have PHP syntax, so the simple question does not. Everyone is right, knot to point.