|
CodeUsage
# phpYahoo: Code Usage IntroductionExample Usage Below are a few examples for using phpYahoo. DetailsInvoking the phpYahoo Class include_once('api/phpYahoo.php'); include_once('api/phpYahooSearch.php'); $ysearch = new phpYahooSearch('jrrxraqsrfgviny'); $ysearch->enableCache('db'); $searchtext= $GET'searchtext'; Yahoo! Web Search ` $params = array("query"=>$keyword,"region"=>"us","type"=>"any","results"=>"20","start"=>$start); $results_web = $y->searchWeb($params); //search text and number of results MAX:50 foreach($results_web as $result) { $html_web .= " //display a link to the search item result $html_web .= ""; $html_web .= " //display the summary $html_web .= $result'summary'; $html_web .= "} echo $html_web; ` Yahoo! Video Search $params = array("query"=>$keyword,"region"=>"us","type"=>"any","results"=>"20","start"=>$start); $results_web = $y->searchVideos($params); foreach($results_video as $result) { $html_video .= " //display a thumbnail of the video with a link $html_video .= ""; $html_video .= " } echo $html_video ; Yahoo! Image Search $params = array("query"=>$keyword,"region"=>"us","type"=>"any","results"=>"20","start"=>$start); $results_images = $y->searchImages($params); OR $results_images = $y->searchImages($searchtext); $html_images .= " \n"; $html_images .= " Sign in to add a comment
|
Sign in to add a comment