Source Code: restyahoo


<?php
    
if($_GET['keyword']) {
    
$keyword $_GET['keyword'];
    
$appid 'YAHOODEVELOPERID'//----get one here http://api.search.yahoo.com/webservices/register_application 
    
$base "http://api.search.yahoo.com/WebSearchService/V1/webSearch";
    
$params = array("appid"=>$appid"query"=>$keyword,"results"=>"20");

    
$url  $base.'?'.http_build_query($params);

    
$c curl_init($url);
    
curl_setopt($c,CURLOPT_RETURNTRANSFER,true);
    
$response curl_exec($c);
    
curl_close($c);
            
    
$xml simplexml_load_string($response);
    
// Load up the root element attributes
    
$html .= "<h2>Yahoo! Search: ".$keyword."</h2>";
                
    
    foreach(
$xml->Result as $result) {  
        
$html .= "<p>\n";        
        
$html .= "<a href='".$result->ClickUrl."' title='".$result->DisplayUrl."'>".$result->Title."</a>";
        
$html .= "<br>";
        
$html .= $result->Summary;
        
$html .= "<br>";
        
$html .= "</p>\n";
    
    }
    
    echo 
$html;
}
?>