本文整理汇总了PHP中Zend_Service_Amazon_S3::getHttpClient方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Service_Amazon_S3::getHttpClient方法的具体用法?PHP Zend_Service_Amazon_S3::getHttpClient怎么用?PHP Zend_Service_Amazon_S3::getHttpClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Service_Amazon_S3
的用法示例。
在下文中一共展示了Zend_Service_Amazon_S3::getHttpClient方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param array|Zend_Config $options
* @return void
*/
public function __construct($options = array())
{
if ($options instanceof Zend_Config) {
$options = $options->toArray();
}
if (!is_array($options)) {
throw new Zend_Cloud_StorageService_Exception('Invalid options provided');
}
if (!isset($options[self::AWS_ACCESS_KEY]) || !isset($options[self::AWS_SECRET_KEY])) {
throw new Zend_Cloud_StorageService_Exception('AWS keys not specified!');
}
try {
$this->_s3 = new Zend_Service_Amazon_S3($options[self::AWS_ACCESS_KEY], $options[self::AWS_SECRET_KEY]);
} catch (Zend_Service_Amazon_S3_Exception $e) {
throw new Zend_Cloud_StorageService_Exception('Error on create: ' . $e->getMessage(), $e->getCode(), $e);
}
if (isset($options[self::HTTP_ADAPTER])) {
$this->_s3->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]);
}
if (isset($options[self::BUCKET_NAME])) {
$this->_defaultBucketName = $options[self::BUCKET_NAME];
}
if (isset($options[self::BUCKET_AS_DOMAIN])) {
$this->_defaultBucketAsDomain = $options[self::BUCKET_AS_DOMAIN];
}
}
示例2: setUp
/**
* Sets up this test case
*
* @return void
*/
public function setUp()
{
$this->_amazon = new Zend_Service_Amazon_S3(constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID'), constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_SECRETKEY'));
$this->_nosuchbucket = "nonexistingbucketnamewhichnobodyshoulduse";
$this->_httpClientAdapterSocket = new Zend_Http_Client_Adapter_Socket();
$this->_bucket = constant('TESTS_ZEND_SERVICE_AMAZON_S3_BUCKET');
$this->_amazon->getHttpClient()->setAdapter($this->_httpClientAdapterSocket);
// terms of use compliance: no more than one query per second
sleep(1);
}
示例3: setUp
/**
* Sets up this test case
*
* @return void
*/
public function setUp()
{
if (!constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ENABLED')) {
$this->markTestSkipped('Zend_Service_Amazon online tests are not enabled');
}
$this->_amazon = new S3\S3(constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID'), constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_SECRETKEY'));
$this->_nosuchbucket = "nonexistingbucketnamewhichnobodyshoulduse";
$this->_httpClientAdapterSocket = new \Zend\Http\Client\Adapter\Socket();
$this->_bucket = constant('TESTS_ZEND_SERVICE_AMAZON_S3_BUCKET');
$this->_amazon->getHttpClient()->setAdapter($this->_httpClientAdapterSocket);
}
示例4: _initApi
protected function _initApi()
{
if (!$this->_apiInitialized) {
@ini_set('max_execution_time', self::TIMEOUT);
@set_time_limit(self::TIMEOUT);
if (!$this->_api) {
$this->_api = new Garp_Service_Amazon_S3($this->_config['apikey'], $this->_config['secret']);
}
$this->_api->getHttpClient()->setConfig(array('timeout' => self::TIMEOUT, 'keepalive' => $this->_config['keepalive']));
$this->_apiInitialized = true;
}
}