santunu23 0 Newbie Poster

I am trying to collect data from amazon market place web service in Scratchpad i get all the values.I am downloading php client library from mws developer website and try to run the code for display those files into browser

POST
 mws.amazonservices.com
 /Products/2011-10-01
    AWSAccessKeyId=AKIAJP5PIHAAXLU6NLDQ&Action=ListMatchingProducts&MarketplaceId=ATVPDKIKX0DER&Query=shoes&SellerId=A2LZO1DGHI8M8V&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2015-01-18T06%3A24%3A58Z&Version=2011-10-01

and according to the post we collect a code which is

<?php
require_once('.config.inc.php');
$base_url = "https://mws.amazonservices.com/Products/2011-10-01";
$method = "POST";
$host = "mws.amazonservices.com";
$uri = "/Products/2011-10-01";

function amazon_xml($searchTerm) {

    $params = array(
        'AWSAccessKeyId' => AWS_ACCESS_KEY_ID,
        'Action' => 'ListMatchingProducts',
        'SellerId' => MERCHANT_ID,
        'SignatureVersion' => '2',
        'Version'=> '2011-10-01',
        'SignatureMethod' => 'HmacSHA256',
        'MarketplaceId'=>MARKETPLACE_ID,
        'Query' => 'shoes');

        $params['Timestamp'] = gmdate('Y-m-d\TH:i:s\Z');





    // Sort the URL parameters
    $url_parts = array();
    foreach (array_keys($params) as $key) {
        $url_parts[] = $key . "=" . str_replace('%7E', '~', rawurlencode($params[$key]));
    }

    sort($url_parts);

    // Construct the string to sign
    $url_string = implode("&", $url_parts);
    $string_to_sign = "POST\nmws.amazonservices.com\n/Products/2011-10-01\n" . $url_string;

    // 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 = urlencode(base64_encode($signature));

    $url = "https://mws.amazonservices.com/Products/2011-10-01" . '?' . $url_string . "&Signature=" . $signature;
    $headers   = array("Content-Type: text/xml");


    $ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);


//echo $url_string;
  curl_setopt($ch, CURLOPT_POSTFIELDS, $headers);

 $response = curl_exec($ch);
 curl_close($ch);
//$parsed_xml = simplexml_load_string($response);
//return ($parsed_xml);
return $response;
print_r $response;   
}

I don't get any return result and don't get the values any suggestions?