我使用以下代碼進行亞馬遜圖書搜索,我有兩個問題提及如下: 1.無法獲得第11頁,因爲它表示無效值爲ItemPage 2.在搜索時我正在買些沒有ISBN號的書,怎麼擺脫它們?我只想要那些有ISBN號的書。麻煩與亞馬遜圖書搜索API PHP
$time = time() + 10000;
$method = 'GET';
$host = 'webservices.amazon.'.AWS_LANG;
$uri = '/onca/xml';
$slug["Service"] = "AWSECommerceService";
$slug["Operation"] = "ItemSearch";
$slug["SubscriptionId"] = AWS_API_KEY;
$slug["AssociateTag"] = AWS_ASSOCIATE_TAG;
$slug["SearchIndex"] = CATEGORY;
$slug["Condition"] = 'All';
$slug["Keywords"] = $query;
$slug["ItemPage"] = 1;
$slug["VariationPage"]=150;
$slug["TruncateReviewsAt"] = '500';
$slug["ResponseGroup"] = 'Images,ItemAttributes';
$slug["Timestamp"] = gmdate("Y-m-d\TH:i:s\Z",$time);
$slug["Version"] = "2011-08-01";
ksort($slug);
$query_slug = array();
foreach ($slug as $slugs=>$value)
{
$slugs = str_replace("%7E", "~", rawurlencode($slugs));
$value = str_replace("%7E", "~", rawurlencode($value));
$query_slug[] = $slugs."=".$value;
}
$query_slug = implode("&", $query_slug);
$signinurl = $method."\n".$host."\n".$uri."\n".$query_slug;
$signature = base64_encode(hash_hmac("sha256", $signinurl, AWS_API_SECRET_KEY, True));
// Get Amazon Signature API
$signature = str_replace("%7E", "~", rawurlencode($signature));
$request = "http://".$host.$uri."?".$query_slug."&Signature=".$signature;
$response = file_get_contents($request);
$response = new SimpleXMLElement($response);
有沒有我可以使用任何其他API,因爲這個環節說,這是不可能得到http://docs.aws.amazon.com/AWSECommerceService/latest/DG/PagingThroughResults.html超過10頁? http://www.textbookrentals.com/search/php這個網站正在處理搜索,我想要這樣的東西。請建議。
感謝 再也
感謝回覆zoltar :) –