当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Gdata_HttpClient::setCookieJar方法代码示例

本文整理汇总了PHP中Zend_Gdata_HttpClient::setCookieJar方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_HttpClient::setCookieJar方法的具体用法?PHP Zend_Gdata_HttpClient::setCookieJar怎么用?PHP Zend_Gdata_HttpClient::setCookieJar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Gdata_HttpClient的用法示例。


在下文中一共展示了Zend_Gdata_HttpClient::setCookieJar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getHttpClient

 private function getHttpClient($userEmail, $password, $proxyHost = null, $proxyPort = null, $tries = 3)
 {
     $authenticationURL = Zend_Gdata_YouTube::CLIENTLOGIN_URL;
     $service = Zend_Gdata_YouTube::AUTH_SERVICE_NAME;
     if (isset($userEmail) && isset($password)) {
         try {
             if (isset($proxyHost) && isset($proxyPort)) {
                 $httpConfig = array('adapter' => 'Zend_Gdata_HttpAdapterStreamingProxy', 'proxy_host' => $proxyHost, 'proxy_port' => $proxyPort, 'maxredirects' => 5, 'timeout' => 120, 'keepalive' => true);
                 //$httpConfig = array ('adapter' => 'Zend_Http_Client_Adapter_Proxy', 'proxy_host' => $proxy->proxy, 'proxy_port' => $proxy->port,'maxredirects' => 10, 'timeout' => 120, 'keepalive' => true );
                 try {
                     // creates a proxied client to use for authentication
                     $clientp = new Zend_Gdata_HttpClient($authenticationURL, $httpConfig);
                     // To turn cookie stickiness on, set a Cookie Jar
                     $clientp->setCookieJar();
                     // authenticate
                     //$httpClient = Zend_Gdata_ClientLogin::getHttpClient ( $userEmail, $password, $service, $clientp );
                     $httpClient = Zend_Gdata_ClientLogin::getHttpClient($userEmail, $password, $service, $clientp, 'WePromoteThis.com', null, null, $authenticationURL);
                     // set the proxy information back into the client
                     // necessary due to http://framework.zend.com/issues/browse/ZF-1920
                     $httpClient->setConfig($httpConfig);
                     //echo ("Using Proxy: $proxyHost port: $proxyPort<br>");
                 } catch (Zend_Gdata_App_HttpException $e) {
                     //var_dump ( $e );
                     //echo ("Error Using Proxy: $proxyHost  port: $proxyPort<br>" . $e->getMessage () . "<br>");
                     $httpClient = Zend_Gdata_ClientLogin::getHttpClient($userEmail, $password, $service, null, 'WePromoteThis.com', null, null, $authenticationURL);
                 }
             } else {
                 //echo ("Not Using Proxy");
                 $httpClient = Zend_Gdata_ClientLogin::getHttpClient($userEmail, $password, $service, null, 'WePromoteThis.com', null, null, $authenticationURL);
             }
         } catch (Exception $e) {
             //echo ("Error getting Youtube HttpClient: " . $e->getMessage () . "<br>");
             $this->httpException = $e->getMessage();
         }
     } else {
         //echo ("Credentials missing. Username: $userEmail | Password length: " . strlen ( $password ) . " <br>");
     }
     if (!isset($httpClient) && $tries > 0) {
         sleep(30);
         $httpClient = $this->getHttpClient($userEmail, $password, $proxyHost, $proxyPort, --$tries);
     }
     return $httpClient;
 }
开发者ID:laiello,项目名称:we-promote-this,代码行数:43,代码来源:WPTYTBoost.php


注:本文中的Zend_Gdata_HttpClient::setCookieJar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。