小编jon*_*ggu的帖子

PHP AWS SDK 3错误:AWS HTTP错误:cURL错误6:无法解析主机:s3.oregon.amazonaws.com

我正在尝试连接到AWS版本3 SDK存储桶。

但是,我收到以下错误:

PHP致命错误:未捕获的异常“ Aws \ S3 \ Exception \ S3Exception”,消息为“在https://s3.oregon.amazonaws.com/my-buekct-test/hello_world.txt ” 上执行“ PutObject”时出错 AWS HTTP错误:cURL错误6:无法解析主机:s3.oregon.amazonaws.com(请参阅http://curl.haxx.se/libcurl/c/libcurl-errors.html)”

这是我的代码,很简单。

<?php
header('Content-Type: text/plain; charset=utf-8');

// Include the SDK using the Composer autoloader
require 'vendor/autoload.php';

$s3 = new Aws\S3\S3Client([
'region'  => 'Oregon',
'version' => 'latest',
'credentials' => [
    'key'    => 'Enter the key',
    'secret' => 'Enter the Secret key'
]
]);

// Send a PutObject request and get the result object.
$key = 'hello_world.txt';

$result = $s3->putObject([
'Bucket' => 'my-buekct-test',
'Key' …
Run Code Online (Sandbox Code Playgroud)

php amazon-s3

4
推荐指数
1
解决办法
9212
查看次数

标签 统计

amazon-s3 ×1

php ×1