Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>$AWS_ACCESS_KEY_ID = "[myaccesskeyhere]"; $AWS_SECRET_ACCESS_KEY = "[mysecretkeyhere]"; $base_url = "http://ecs.amazonaws.com/onca/xml?"; $url_params = array('Operation'=&gt;"ItemSearch",'Service'=&gt;"AWSECommerceService", 'AWSAccessKeyId'=&gt;$AWS_ACCESS_KEY_ID,'AssociateTag'=&gt;"yourtag-10", 'Version'=&gt;"2006-09-11",'Availability'=&gt;"Available",'Condition'=&gt;"All", 'ItemPage'=&gt;"1",'ResponseGroup'=&gt;"Images,ItemAttributes,EditorialReview", 'Keywords'=&gt;"Amazon"); // Add the Timestamp $url_params['Timestamp'] = gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time()); // Sort the URL parameters $url_parts = array(); foreach(array_keys($url_params) as $key) $url_parts[] = $key."=".$url_params[$key]; sort($url_parts); // Construct the string to sign $string_to_sign = "GET\necs.amazonaws.com\n/onca/xml\n".implode("&amp;",$url_parts); $string_to_sign = str_replace('+','%20',$string_to_sign); $string_to_sign = str_replace(':','%3A',$string_to_sign); $string_to_sign = str_replace(';',urlencode(';'),$string_to_sign); // Sign the request $signature = hash_hmac("sha256",$string_to_sign,$AWS_SECRET_ACCESS_KEY,TRUE); // Base64 encode the signature and make it URL safe $signature = base64_encode($signature); $signature = str_replace('+','%2B',$signature); $signature = str_replace('=','%3D',$signature); $url_string = implode("&amp;",$url_parts); $url = $base_url.$url_string."&amp;Signature=".$signature; print $url; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 15); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); $xml_response = curl_exec($ch); echo $xml_response; </code></pre> <p>For anyone that was wondering. You can then navigate the xml_response using simplexml!</p> <p>Hope this helps someone out there :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload