Reputation: 531
require "config.php";
require __DIR__ . '/vendor/autoload.php';
$sdk = new Aws\Sdk([
'region' => 'us-east-1',
'version' => 'latest',
'credentials' => array(
'key' => $global_access_key,
'secret' => $global_secret_key,
),
]);
$dynamodb = $sdk->createDynamoDb();
$response = $dynamodb->getItem([
'TableName' => $global_table_name,
'Key' => [
'userid' => [ 'N' => '1' ]
]
]);
var_dump($response);
die;
when i try to run this code it gives the error which is defined as :
Fatal error: Uncaught exception 'Aws\DynamoDb\Exception\DynamoDbException' with message 'Error executing "GetItem" on "https://dynamodb.us-east-1.amazonaws.com"; AWS HTTP error: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in C:\wamp\www\practice\vendor\aws\aws-sdk-php\src\WrappedHttpHandler.php on line 159
Upvotes: 1
Views: 975
Reputation: 1098
Rather than disabling the SSL verification, which might leads to a man in the middle attack. below solution would be more secure and appropriate.
version 2.X:-
$aws = Aws\Common\Aws::factory(array(
'region' => 'us-west-2',
'key' => '****',
'secret' => '****',
'ssl.certificate_authority' => 'C:\nginx\cert\cert.pem'
));
version 3.X :-
$client = new DynamoDbClient([
'region' => 'us-west-2',
'version' => 'latest',
'http' => [
'verify' => 'C:\nginx\cert\cert.pem'
]
]);
refference :-
https://s3.cn-north-1.amazonaws.com.cn/aws-dam-prod/china/pdf/aws-sdk-php-guide.pdf
http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/configuration.html#verify
Upvotes: 1
Reputation: 531
$sdk = new Aws\Sdk([
'region' => 'us-east-1',
'version' => 'latest',
'credentials' => array(
'key' => $global_access_key,
'secret' => $global_secret_key,
),
'signature_version' => 'v4',
'http' => [
'verify' => false
]
]);
got an answer from reading the documentation
Upvotes: 1