etrader Posted January 21, 2011 Share Posted January 21, 2011 According to the instruction provided by in http://www.gigablast.com/searchfeed.html#output gigablast provides a normal xml which can be read as <response> <result> <title> </title> </result> </response> but when checking an example xml page like http://www.gigablast.com/search?q=korn&raw=9, it is a text file without attributes, and I was unable to read it as array by simplexml_load_file. :-\ Quote Link to comment Share on other sites More sharing options...
trq Posted January 22, 2011 Share Posted January 22, 2011 Looks like xml to me. Quote Link to comment Share on other sites More sharing options...
requinix Posted January 22, 2011 Share Posted January 22, 2011 "Text file without attributes"? What? It's definitely XML content, and the server says it's text/xml too... $xml = new SimpleXMLElement("http://www.gigablast.com/search?q=korn&raw=9", 0, true); echo (string)$xml->result[0]->sum; Quote Link to comment Share on other sites More sharing options...
etrader Posted January 22, 2011 Author Share Posted January 22, 2011 Yes, it is xml but somehow different. How can I turn it into array? when doing $xml = simplexml_load_file("http://www.gigablast.com/search?q=korn&raw=9"); print_r($xml); The result is SimpleXMLElement Object ( [hits] => 1033508 [moreResultsFollow] => 1 [result] => Array ( [0] => SimpleXMLElement Object ( [title] => SimpleXMLElement Object ( ) [sum] => SimpleXMLElement Object ( ) [url] => ... As you see, instead of actual words of title it shows "[title] => SimpleXMLElement Object ( )" Quote Link to comment Share on other sites More sharing options...
etrader Posted January 22, 2011 Author Share Posted January 22, 2011 Oh, Thanks! with new SimpleXMLElement; I got it Quote Link to comment 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.