Using this 'AWS connector' module, we can not find the exact service for the HTTP POST request with the AWS signature authorization .

In readme.md file we have the code, but to make the HTTP POST request am unable to pick the exact service as per https://docs.aws.amazon.com/aws-sdk-php/v3/api/. Please suggest which service we need to use HTTP POST request for the AWS signature authorization?

Apart from that, We have tried the below curl code and not able to get the any result. Its showing the white blank screen without any errors.

 $startTimestamp = time(); 
    $amz = gmdate('Ymd\THis\Z', $startTimestamp);
    $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api-runtime.us-east-1.amazonaws.com/endpoint",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "{\n\t\"campaignArn\":\"arn:aws:test:us-east-1:12456:campaign/test\",\n\t\"numResults\":2,\n\t\"userId\":\"400\"\n}",
      CURLOPT_HTTPHEADER => array(
        '"authorization: AWS4-HMAC-SHA256 Credential=**********/20191205/us-east-1/Test/aws4_request, 
      SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-target, 
      Signature=' . $signature . '"',
        '"cache-control: no-cache"',
        '"content-type: application/json"',
        '"host: test-runtime.us-east-1.amazonaws.com"',
        '"x-amz-date:' . $amz . '"',
        '"x-amz-target: getrecommendations"'
      ),
    )); 
$result = curl_exec($curl);
if($result === false) {
    echo "Error in CURL : " . curl_error($curl);
}
else {
  echo 'no error'.$result;
}

Please check and share the valuable inputs / reference.

Thanks.

Comments

Ravi Shankar Karnati created an issue. See original summary.

ravi shankar karnati’s picture

Issue summary: View changes
ravi shankar karnati’s picture

Issue summary: View changes
ravi shankar karnati’s picture

Issue summary: View changes