I've create a little script which searches using yahoo.
But sometimes I search something I get:
Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/search.php on line 240
Heres the code which is causing the problem:
<?
if ($rs = $rss->get("http://api.search.yahoo.com/WebSearchService/rss/webSearch.xml?appid=yahoosearchwebrss&query=originurlextension%3Apdf+$search&adult_ok=1&start=$start")) {
}
// Go through the list powered by the search engine listed and get the data from each <item>
foreach($rs['items'] as $item) { //this is line 240
// Get the title of result
$title = $item['title'];
// Get the description of the result
$description = $item['description'];
// Get the link eg amazon.com
$urllink = $item['guid'];
include "templates/result.php";
echo "\n";
}
?>
All help is greatly apreciated