'Auto amazon product widgets by seegatesite.com')); wp_register_widget_control('aapws_id','aapws','aapws_control'); function aapws_control($args=array(), $params=array()) { if (isset($_POST['submitted'])) { update_option('aapws_title', $_POST['widgettitle']); update_option('aapws_tag_id', $_POST['tag_id']); update_option('aapws_pub_key', $_POST['pub_key']); update_option('aapws_priv_key', $_POST['priv_key']); update_option('aapws_searchindex', $_POST['searchindex']); update_option('aapws_keyword', $_POST['keyword']); update_option('aapws_location', $_POST['location']); update_option('aapws_count', $_POST['count']); } //load options $widgettitle = get_option('aapws_title'); $tag_id = get_option('aapws_tag_id'); $pub_key = get_option('aapws_pub_key'); $priv_key = get_option('aapws_priv_key'); $searchindex = get_option('aapws_searchindex'); $keyword = get_option('aapws_keyword'); $location = get_option('aapws_location'); $count = get_option('aapws_count'); ?> Widget Title :


Tag id :


Public key :


Private key :


Searchindex :


Keyword :


Location :


Count :


"; if(isset($xml->Items)) { $cnt = count($xml->Items->Item); for($i=0; $i<$cnt; $i++) { echo "
  • "; $detailurl = $xml->Items->Item[$i]->DetailPageURL; $img = $xml->Items->Item[$i]->SmallImage->URL; $title = $xml->Items->Item[$i]->ItemAttributes->Title; $price = $xml->Items->Item[$i]->OfferSummary->LowestNewPrice->FormattedPrice; $desc = $xml->Items->Item[$i]->EditorialReviews->EditorialReview->Content; echo '

    '; echo ''; echo ''.substr($title,0,70).'...
    '; echo 'Price : '.$price.'
    '; echo strtolower(substr($desc,0,70)).'...
    '; echo 'more detail'; echo "

  • "; if($i == $count-1) { break; } } } echo ''; ?> 'ItemSearch', 'Keywords' => $keyword , 'SearchIndex' => $searchindex , 'AssociateTag' => $tag_id, //tag url 'ResponseGroup' => 'Medium' , ); $ext=$location; //extension of server, see data.php ksort($params); $method = "GET"; $host = "ecs.amazonaws.".$ext; $uri = "/onca/xml"; $params["Service"] = "AWSECommerceService"; $params["AWSAccessKeyId"] = $pub_key; $params["Timestamp"] = gmdate("Y-m-d\TH:i:s\Z",time()); //may not be more than 15 minutes out of date! $params["Version"] = "2009-03-31"; ksort($params); $canonicalized_query = array(); foreach ($params as $param=>$value) { $param = str_replace("%7E", "~", rawurlencode($param)); $value = str_replace("%7E", "~", rawurlencode($value)); $canonicalized_query[] = $param."=".$value; } $canonicalized_query = implode("&", $canonicalized_query); $string_to_sign = $method."\n".$host."\n".$uri."\n".$canonicalized_query; $signature = base64_encode(hash_hmac("sha256", $string_to_sign, $priv_key, True)); $signature = rawurlencode($signature); $request = "http://".$host.$uri."?".$canonicalized_query."&Signature=".$signature; return $request; } ?>