Source Code: yahooshoppingsearch
<?php
if($_POST['keyword']) {
$keyword = $_POST['keyword'];
$base = "http://api.shopping.yahoo.com/ShoppingService/V1/productSearch";
$params = array("appid"=>"jrrxraqsrfgviny", "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! Shopping Search: ".$keyword."</h2>";
foreach($xml->Result as $result) {
foreach($result->Offer as $result) {
$html .= "<p>\n";
$html .= "<img src='".$result->Thumbnail->Url."' class=left>";
$html .= "<a href='".$result->Url."' title='".$result->ProductName."'>".$result->ProductName."</a>";
$html .= "<br>";
$html .= $result->Summary;
$html .= "<br>";
$html .= "<br>";
$html .= "</p>\n";
$html .= "<br>";
}
}
echo $html;
}
?>





