Page 1 of 1

HELP ME TO FIX THIS CODE

Posted: Fri Dec 24, 2010 2:55 am
by arisandria2013
i've PSD SEARCH ENGINE SCRIPT but the script ERROR in search.php
when i tested in XAMPP the script 100% succes but in webhosting ERROR. HELP ME TO FIX THIS CODE PLEASE..

Code: Select all

<?
if ($rs = $rss->get("http://api.search.yahoo.com/WebSearchService/rss/webSearch.xml?appid=yahoosearchwebrss&query=originurlextension%3Apsd+$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) { 

	// 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 "Class/resulttemplate.php";

 echo "\n"; 
}
?>
ERROR CODE:

Code: Select all

Warning: Invalid argument supplied for foreach() in /home/vol2/xxxxxx.com/xth_xxxxx/xxxx-xxx.co.cc/htdocs/search.php on line 56
this is link to download PSD SEARCH ENGINE SCRIPT if you want to test it: http://www.uploadhappy.com/files/1TFHZH ... engine.rar

HELP ME TO FIX IT PLEASE.. THANK YOU

Re: HELP ME TO FIX THIS CODE

Posted: Fri Dec 24, 2010 3:35 am
by social_experiment
Foreach() statements need an array to work properly. Is $rs['items'] an array?

Re: HELP ME TO FIX THIS CODE

Posted: Fri Dec 24, 2010 4:03 pm
by califdon
Just before the foreach line, print out the contents of $rs, using the PHP function print_r($rs). It should print out an array structure. If it does not, you will have to go back to where $rs was created and find out why not.