w1ww Posted February 10, 2007 Share Posted February 10, 2007 Hello Freaks ! I'm trying to use the yahoo search api, that returns a XML file and I've this script to phrase the XML, but the script returns a blank screen: (You can see an example of what the yahoo returns here: http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemo&query=madonna&results=2) <?php $key = "MYKEY"; $query = "something"; $language = "en"; $url = "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=".$key."&query=".$query."&results=10&language=".$language.""; $count = 10; //* get the xml file $xml = simplexml_load_file($url); //* phrase all the data from the xml so we can display it for ($x = 0; $x < $count; $x++) { //* this bits for if its an rss 1 feed if (isset($xml->item)) { $item = $xml->item[$x]; } //* this bits for 0.91 rss feeds elseif (isset($xml->Result->item)) { $item = $xml->Result->item[$x]; } //* show the headline and the description echo "<a href=\"$item->Url\">$item->Title</a><br>$item->Summary<br><br>"; } //* reset variables unset($xml); unset($item); //* close the function loop ?> Thank you! Link to comment https://forums.phpfreaks.com/topic/37896-php-xml-and-the-yahoo-api/ Share on other sites More sharing options...
w1ww Posted February 11, 2007 Author Share Posted February 11, 2007 No one ? Link to comment https://forums.phpfreaks.com/topic/37896-php-xml-and-the-yahoo-api/#findComment-181943 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.