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; }
/** * 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; }