本文整理汇总了PHP中Zend_Gdata::setStaticHttpClient方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata::setStaticHttpClient方法的具体用法?PHP Zend_Gdata::setStaticHttpClient怎么用?PHP Zend_Gdata::setStaticHttpClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata
的用法示例。
在下文中一共展示了Zend_Gdata::setStaticHttpClient方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setHttpClient
public function setHttpClient($client, $applicationId = 'MyCompany-MyApp-1.0')
{
if ($client === null) {
$client = new Zend_Http_Client();
}
if (!$client instanceof Zend_Http_Client) {
require_once 'Zend/Gdata/App/HttpException.php';
throw new Zend_Gdata_App_HttpException('Argument is not an instance of Zend_Http_Client.');
}
$userAgent = $applicationId . ' Zend_Framework_Gdata/' . Zend_Version::VERSION;
$client->setHeaders('User-Agent', $userAgent);
$client->setConfig(array('strictredirects' => true));
$this->_httpClient = $client;
Zend_Gdata::setStaticHttpClient($client);
return $this;
}
示例2: setHttpClient
/**
* Set the Zend_Http_Client object used for communication
*
* @param Zend_Http_Client $client The client to use for communication
* @throws Zend_Gdata_App_HttpException
* @return Zend_Gdata_App Provides a fluent interface
*/
public function setHttpClient($client)
{
if ($client === null) {
$client = new Zend_Http_Client();
}
if (!$client instanceof Zend_Http_Client) {
require_once 'Zend/Gdata/App/HttpException.php';
throw new Zend_Gdata_App_HttpException('Argument is not an instance of Zend_Http_Client.');
}
$useragent = 'Zend_Framework_Gdata/' . Zend_Version::VERSION;
$client->setConfig(array('strictredirects' => true, 'useragent' => $useragent));
$this->_httpClient = $client;
Zend_Gdata::setStaticHttpClient($client);
return $this;
}