I am trying to connect to a bucket of SDK version 3.
But I get the following error:
PHP Fatal error: exception "Aws \ S3 \ Exception \ S3Exception" with the message "Runtime error" PutObject "at" https://s3.oregon.amazonaws.com/my-buekct-test/hello_world.txt "; AWS HTTP error : cURL 6 error: failed to resolve host: s3.oregon.amazonaws.com (see http://curl.haxx.se/libcurl/c/libcurl-errors.html ) '
This is my code, simple.
<?php
header('Content-Type: text/plain; charset=utf-8');
require 'vendor/autoload.php';
$s3 = new Aws\S3\S3Client([
'region' => 'Oregon',
'version' => 'latest',
'credentials' => [
'key' => 'Enter the key',
'secret' => 'Enter the Secret key'
]
]);
$key = 'hello_world.txt';
$result = $s3->putObject([
'Bucket' => 'my-buekct-test',
'Key' => $key,
'Body' => 'this is the body!'
]);
echo $result['Body'];
I am using AWS centos, php 5.5.21, apache 2.4.10
Could you indicate where I made a mistake?
source
share