recentpopularlog in
« earlier  
Among high-income nations, 91 percent of children younger than 15 who were killed by gunfire lived in U.S.
Among high-income nations, 91 percent of children younger than 15 who were killed by gunfire lived in the United States.
general  tweet  guns 
16 days ago
Amazon API Tutorial With PHP - class object
<?php
class Amazon
{

// public key
var $publicKey = "xxxxxxxxxxxxxx";
// private key
var $privateKey = "xxxxxxxxxxxxx";
// affiliate tag
var $affiliateTag='affiliateTag';

/**
*Get a signed URL
*@param string $region used to define country
*@param array $param used to build url
*@return array $signature returns the signed string and its components
*/
public function generateSignature($param)
{
// url basics
$signature['method']='GET';
$signature['host']='ecs.amazonaws.'.$param['region'];
$signature['uri']='/onca/xml';

// necessary parameters
$param['Service'] = "AWSECommerceService";
$param['AWSAccessKeyId'] = $this->publicKey;
$param['Timestamp'] = gmdate("Y-m-d\TH:i:s\Z");
$param['Version'] = '2009-10-01';
ksort($param);
foreach ($param as $key=>$value)
{
$key = str_replace("%7E", "~", rawurlencode($key));
$value = str_replace("%7E", "~", rawurlencode($value));
$queryParamsUrl[] = $key."=".$value;
}
// glue all the "params=value"'s with an ampersand
$signature['queryUrl']= implode("&", $queryP
amazonapi 
july 2017
AWS Developer Forums: Building [Request Signature] for ...
$endpoint = "webservices.amazon.com";
$uri = "/onca/xml";
$params = array(
"Service" => "AWSECommerceService",
"Operation" => "BrowseNodeLookup",
"AWSAccessKeyId" => "AKIAJBOZBVKUOXWPSNPA",
"AssociateTag" => "distributedxx",
"BrowseNodeId" => "541966",
"ResponseGroup" => "BrowseNodeInfo"
);
// Set current timestamp if not set
if (!isset($params["Timestamp"])) {
$params["Timestamp"] = gmdate('Y-m-d\TH:i:s\Z');
}
// Sort the parameters by key
ksort($params);
$pairs = array();
foreach ($params as $key => $value) {
array_push($pairs, rawurlencode($key)."=".rawurlencode($value));
}
// Generate the canonical query
$canonical_query_string = join("&", $pairs);
// Generate the string to be signed
$string_to_sign = "GET\n".$endpoint."\n".$uri."\n".$canonical_query_string;
// Generate the signature required by the Product Advertising API
$signature = base64_encode(hash_hmac("sha256", $string_to_sign, $aws_secret_key, true));
// Generate the signed URL
$request_url = 'http://'.$endpoint.$uri.'?'.$canonical_query_string.'&Signature='.rawurlencode($signature);
echo "Signed URL: \"".$request_url."\"";
amazonapi 
july 2017
« earlier      
per page:    204080120160

Copy this bookmark:





to read