웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
아마존 상품API 소스中 상품정보 가져오는 소스
2015.03.10 23:08
$AssociateTag = '[Your - AssociateTag]';
$AccessKeyId = [Your - AccessKeyId];
$SecretAccessKey = '[Your - SecretAccessKey]';
$endPoint = 'webservices.amazon.com';
$requestUrl = '/onca/xml';
$requestMethod = 'GET';
$params["Service"] = "AWSECommerceService";
$params['AssociateTag'] = $AssociateTag;
$params['Operation'] = 'ItemLookup';
$params['ItemId'] = 'B001AS696K';
$params['ResponseGroup'] = 'Large';
$params["AWSAccessKeyId"] = $AccessKeyId;
$params["Timestamp"] = gmdate("Y-m-d\TH:i:s\Z");
$params["Version"] = "2011-08-01";
ksort($params);
$canonicalQS = array();
foreach ($params as $param=>$value){
$param = str_replace("%7E", "~", rawurlencode($param));
$value = str_replace("%7E", "~", rawurlencode($value));
$canonicalQS[] = $param."=".$value;
}
$canonicalQS = implode("&", $canonicalQS);
$SignatureText = $requestMethod."\n".$endPoint."\n".$requestUrl."\n".$canonicalQS;
$Signature = base64_encode(hash_hmac("sha256", $SignatureText, $SecretAccessKey, true));
$callURL = 'http://'.$endPoint.$requestUrl.'?'.$canonicalQS.'&Signature='.$Signature;
$response = @file_get_contents($callURL);
$responseXML = simplexml_load_string($response);
print_r($responseXML);
http://s3.amazonaws.com/awsdocs/Associates/2011-08-01/prod-adv-api-dg-2011-08-01.pdf
자세한 부분은 위 문서 참고.
출처 : PHP스쿨 기존 글 각색
$AccessKeyId = [Your - AccessKeyId];
$SecretAccessKey = '[Your - SecretAccessKey]';
$endPoint = 'webservices.amazon.com';
$requestUrl = '/onca/xml';
$requestMethod = 'GET';
$params["Service"] = "AWSECommerceService";
$params['AssociateTag'] = $AssociateTag;
$params['Operation'] = 'ItemLookup';
$params['ItemId'] = 'B001AS696K';
$params['ResponseGroup'] = 'Large';
$params["AWSAccessKeyId"] = $AccessKeyId;
$params["Timestamp"] = gmdate("Y-m-d\TH:i:s\Z");
$params["Version"] = "2011-08-01";
ksort($params);
$canonicalQS = array();
foreach ($params as $param=>$value){
$param = str_replace("%7E", "~", rawurlencode($param));
$value = str_replace("%7E", "~", rawurlencode($value));
$canonicalQS[] = $param."=".$value;
}
$canonicalQS = implode("&", $canonicalQS);
$SignatureText = $requestMethod."\n".$endPoint."\n".$requestUrl."\n".$canonicalQS;
$Signature = base64_encode(hash_hmac("sha256", $SignatureText, $SecretAccessKey, true));
$callURL = 'http://'.$endPoint.$requestUrl.'?'.$canonicalQS.'&Signature='.$Signature;
$response = @file_get_contents($callURL);
$responseXML = simplexml_load_string($response);
print_r($responseXML);
http://s3.amazonaws.com/awsdocs/Associates/2011-08-01/prod-adv-api-dg-2011-08-01.pdf
자세한 부분은 위 문서 참고.
출처 : PHP스쿨 기존 글 각색