title: Amazon MWS Products SignatureDoesNotMatch
body: <p>When I run this code, I get a SignatureDoesNotMatch error. I'm not finding the issue. I even commented out the sort() to keep the array in natural order. Any help would be appreciated.</p>
  
  <pre><code>    $params = array(
      'AWSAccessKeyId' =&gt; "*********",
      'Action' =&gt; "GetCompetitivePricingForASIN",
      'SellerId' =&gt; "********",
      'SignatureVersion' =&gt; "2",
      'Timestamp' =&gt; gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time()),
      'Version' =&gt; "2011-10-01",
      'SignatureMethod' =&gt; "HmacSHA256",
      'MarketplaceId' =&gt; "ATVPDKIKX0DER",
      'AsinList.ASIN.1' =&gt; $asin
  
  
      );
  
      $url_parts = array();
      foreach (array_keys($params) as $key)
      $url_parts[] = $key . "=" . str_replace('%7E', '~', rawurlencode($params[$key]));
      //sort($url_parts);
      $url_string     = implode("&amp;", $url_parts);
      $string_to_sign = "GET\nmws.amazonservices.com\n/Products/2011-10-01\n" .     $url_string;
      $signature = hash_hmac("sha256", $string_to_sign, AWS_SECRET_ACCESS_KEY, TRUE);
      $signature = urlencode(base64_encode($signature));
      $url = "https://mws.amazonservices.com/Orders/2011-10-01" . '?' . $url_string .  "&amp;Signature=" . $signature;
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
      $response = curl_exec($ch);
      $xml      = simplexml_load_string($response);
  
      echo $xml-&gt;asXML();
  </code></pre>