如何设置网络代理亚马逊S3服务器 [英] How to set internet proxy for amazon s3 server
问题描述
如何设置网络代理亚马逊s3.i正在逐渐警告:S3 :: putObject():[7]无法连接到主机,在E无错误:\瓦帕\的www \ S3 \ s3.php上线363 。我知道这是因为代理issue.but我有关的不知道如何添加代理的S3.given下面是我的code的。
How to set internet proxy for amazon s3.i am getting Warning: S3::putObject(): [7] Failed connect to Host,No error in E:\wamp\www\S3\s3.php on line 363.i know this is because of proxy related issue.but i don't know how to add proxy in S3.given below is my code.
的index.php
index.php
<?php
require 's3.php';
$s3 = new S3('ACCESS_KEY_ID', 'SECRET_ACCESS_KEY');
$new_name = time(). '.txt';
S3::putObject(
$s3->inputFile('upload-me.txt',false),
'bucket name',
$new_name,
S3::ACL_PUBLIC_READ,
array(),
array(),
S3::STORAGE_CLASS_RRS
);
?>
在此先感谢:
推荐答案
使用该方法的 setProxy
S3::setProxy('127.0.0.1:1234');
如果你是静态调用 putObject 方法,你应该设置凭据静态太:
If you are statically calling the putObject method, you should set the credentials statically too:
S3::setAuth('ACCESS_KEY_ID', 'SECRET_ACCESS_KEY');
在另一方面,如果你想通过AWS SDK直接做,请在<一个使用代理一节href="http://docs.aws.amazon.com/aws-sdk-php/guide/latest/configuration.html#client-configuration-options"相对=nofollow>客户端配置页。
On the other hand, if you want to do it via AWS SDK directly, refer the "Using a proxy" section on the client configurations page.
$s3Client = S3Client::factory(array(
'request.options' => array(
'proxy' => '127.0.0.1:1234'
)
));
$credentials = new Credentials('ACCESS_KEY_ID', 'SECRET_ACCESS_KEY');
$s3Client->setCredentials($credentials);
$s3Client->putObject(array(
...
));
这篇关于如何设置网络代理亚马逊S3服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!