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. :-\ Link to comment https://forums.phpfreaks.com/topic/225262-simplexml-of-gigablast-search-engine/ Share on other sites More sharing options...
trq Posted January 22, 2011 Share Posted January 22, 2011 Looks like xml to me. Link to comment https://forums.phpfreaks.com/topic/225262-simplexml-of-gigablast-search-engine/#findComment-1163408 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; Link to comment https://forums.phpfreaks.com/topic/225262-simplexml-of-gigablast-search-engine/#findComment-1163457 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 ( )" Link to comment https://forums.phpfreaks.com/topic/225262-simplexml-of-gigablast-search-engine/#findComment-1163459 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 Link to comment https://forums.phpfreaks.com/topic/225262-simplexml-of-gigablast-search-engine/#findComment-1163462 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.