Browse by Catagory:\n\n");
foreach ($mcats as $k => $catname) {
printf("- %s\n",
urlencode($searchmode),$mnodes[$k],$catname);
}
printf("
\n");
flush();
?>
|
0)
printf("%s\n",$subtitle)
?>
0) {
$row=pg_fetch_assoc($r);
#syslog(LOG_NOTICE,"db hit");
pg_close($db);
return base64_decode($row['rsp']);
}
#syslog(LOG_INFO,$u);
flush();
$content='';
for ($tries=0;$tries<3;$tries) {
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $u);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 31);
#curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:3128');
$content=curl_exec($ch);
$res=curl_getinfo($ch);
print_r($res);
print_r($content);
$hnd=fopen("/tmp/aws4-ske","w");
fwrite($hnd,$content);
if ($res['http_code'] != 503) {
if ($res['http_code'] != 200) syslog(LOG_NOTICE,'http_code: '.$res['http_code']);
break;
} else {
#header("HTTP/1.1 503 Busy");
syslog(LOG_NOTICE,'http_code: '.$res['http_code']);
exit;
}
curl_close($ch);
sleep(2);
}
curl_close($ch);
$hnd=fopen("/tmp/aws4-ske","w");
fwrite($hnd,$content);
fclose($hnd);
$q=sprintf("insert into aws (qs, rsp) values ('%s','%s')",
pg_escape_string($qs),
pg_escape_string(base64_encode($content)));
$r=pg_query($q);
pg_close($db);
return $content;
}
$icnt=0;
$page=$_REQUEST['page'];
if ($page<1)
$page=1;
flush();
if (!($i%2))
printf("\n");
$method = "GET";
$host = "ecs.amazonaws.".$region;
$uri = "/onca/xml";
$parms=array();
// additional parameters
$params["Service"] = "AWSECommerceService";
$params["AWSAccessKeyId"] = $publickey;
// GMT timestamp
$params["Timestamp"] = gmdate("Y-m-d\TH:i:s\Z");
// API version
$params["Version"] = "2011-08-01";
$params['SubscriptionId']=$publickey;
$params['AssociateTag']='skeartcom-20';
$params['Operation']='ItemSearch';
if (strlen($_REQUEST['ss'])<1) {
$params['BrowseNode']=urlencode($browsenode);
} else {
$params['Keywords']=urlencode($_REQUEST['ss']);
}
if (strlen($searchmode)>0)
$params['SearchIndex']=urlencode($searchmode);
else
$params['SearchIndex']='Books';
$params['ResponseGroup']='Large';
$params['ItemPage']=urlencode($page);
if (strlen($_REQUEST['sort'])) {
$params['Sort']=urlencode($_REQUEST['sort']);
}
// sort the parameters
ksort($params);
// create the canonicalized query
$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);
// create the string to sign
$string_to_sign = $method."\n".$host."\n".$uri."\n".$canonicalized_query;
// calculate HMAC with SHA256 and base64-encoding
$signature = base64_encode(hash_hmac("sha256", $string_to_sign, $privatekey, True));
// encode the signature for the request
$signature = str_replace("%7E", "~", rawurlencode($signature));
// create request
$u = "http://".$host.$uri."?".$canonicalized_query."&Signature=".$signature;
#syslog(LOG_NOTICE,$u);
#echo $u.'<--';
$img="";
$rank="";
$avail="";
$prodname="";
$price="";
$listprice="";
$author="";
$file = "data.xml";
$pages=0;
$moreres='';
$depth = array();
#syslog(LOG_INFO,$u);
$fp=query_server('ecs.amazon.com',80,$u);
#echo $fp;
$xml=new SimpleXMLElement($fp);
$items=$xml->Items;
$pages=$items->TotalPages;
$page=$items->Request->ItemSearchRequest->ItemPage;
if (!empty($xml->Items->MoreSearchResultsUrl))
$moreres=$xml->Items->MoreSearchResultsUrl;
$some=0;
if (!empty($items->Item)) foreach ($items->Item as $item) {
if ($some==0) {
printf("\n");
$some=1;
}
$asin=$item->ASIN;
printf("");
printf("%s \n",$asin,$item->ItemAttributes->Title);
if (!empty($item->MediumImage->URL)) {
printf(" \n",$asin,$item->MediumImage->URL,htmlspecialchars($item->ItemAttributes->Title));
}
if (!empty($item->OfferSummary->LowestNewPrice->FormattedPrice))
printf("Lowest new price: %s \n",$item->OfferSummary->LowestNewPrice->FormattedPrice);
if (!empty($item->OfferSummary->LowestUsedPrice->FormattedPrice))
printf("Lowest used price: %s \n",$item->OfferSummary->LowestUsedPrice->FormattedPrice);
if (!empty($item->ItemAttributes->ListPrice->FormattedPrice))
printf("List price: %s \n",$item->ItemAttributes->ListPrice->FormattedPrice);
flush();
if (!empty($item->ItemAttributes->Author))
printf("Author: %s \n",$item->ItemAttributes->Author);
if (!empty($item->ItemAttributes->Brand))
printf("Brand: %s \n",$item->ItemAttributes->Brand);
if (!empty($item->ItemAttributes->Model))
printf("Model: %s \n",$item->ItemAttributes->Model);
printf(" | \n ");
flush();
if (!empty($item->EditorialReviews->EditorialReview)) foreach ($item->EditorialReviews->EditorialReview as $rev) {
if (!empty($rev->Content))
printf(" %s \n",$rev->Content);
flush();
}
$sflag=0;
foreach ($item->ItemAttributes->Feature as $feat) {
if ($sflag==0) {
printf(" Features:
\n");
$sflag=1;
}
printf("- %s\n",$feat);
}
if ($sflag>0)
printf("
\n");
flush();
$sims=$item->SimilarProducts;
$sflag=0;
if (!empty($sims->SimilarProduct)) foreach ($sims->SimilarProduct as $sim) {
if ($sflag==0) {
printf(" Similar Products:
\n");
$sflag=1;
}
if (!empty($sim->ASIN))
printf("- %s\n",$sim->ASIN,$sim->Title);
}
if ($sflag>0)
printf("
\n");
printf(" |
| \n");
flush();
}
if ($some>0)
printf(" \n");
printf(" \n");
flush();
if ($page+1>$pages)
$p=1;
else
$p=$page+1;
$sm=$searchmode;
if (strlen($sm)<1)
$sm='DVD';
if ($pages>1) {
if (strlen($_REQUEST['ss'])>0) {
echo '';
if ($p>10) {
if (!empty($moreres)) printf('Next >>',$moreres);
} else {
printf(" Next >>\n",
$p,urlencode($_REQUEST['ss']),$sm);
}
} else {
echo ' ';
if ($page>1)
printf("<< Prev \n",
$sm,$browsenode,$page-1);
if ($p>10) {
if (!empty($moreres)) printf('Next >>',$moreres);
} else {
printf("Next >>\n",
$sm,$browsenode,$p);
}
}
}
printf(" Page %d of %d\n",$page,$pages);
flush();
pg_close();
?>
[Kindle]
[Kindle DX]
CERTAIN CONTENT THAT APPEARS ON THIS SITE COMES FROM AMAZON SERVICES LLC. THIS CONTENT IS PROVIDED AS IS AND IS SUBJECT TO CHANGE OR REMOVAL AT ANY TIME.
|