當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HTTP_Request2::__construct方法代碼示例

本文整理匯總了PHP中HTTP_Request2::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTTP_Request2::__construct方法的具體用法?PHP HTTP_Request2::__construct怎麽用?PHP HTTP_Request2::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HTTP_Request2的用法示例。


在下文中一共展示了HTTP_Request2::__construct方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * __construct
  *
  * @param string $server Url, including port and database name.
  *
  * @return $this
  * @uses   parent::__construct()
  */
 public function __construct($server)
 {
     $this->server = $server;
     parent::__construct($server);
     // force this for all calls
     $this->setHeader('Content-type: application/json; charset=utf-8');
 }
開發者ID:jeremykendall,項目名稱:spaz-api,代碼行數:15,代碼來源:ArmChair.php

示例2: __construct

 public function __construct($url)
 {
     parent::__construct($url);
     $this->setConfig('follow_redirects', true);
     $this->setConfig('connect_timeout', 5);
     $this->setConfig('timeout', 10);
     $this->setConfig('ssl_verify_peer', false);
     $this->setHeader('user-agent', 'phinde/bot');
 }
開發者ID:cweiske,項目名稱:phinde,代碼行數:9,代碼來源:HttpRequest.php

示例3: __construct

 /**
  * Defaults to CliAdapter, and enables the 'index_file' setting.
  * 
  * @param string $url
  * @param int $method
  * @param array $config 
  */
 public function __construct($url = null, $method = self::METHOD_GET, array $config = array())
 {
     if (empty($config['adapter'])) {
         $config['adapter'] = new CliAdapter();
     }
     $this->config['index_file'] = '';
     $this->checkConfig($config);
     parent::__construct($url, $method, $config);
 }
開發者ID:runekaagaard,項目名稱:php-cli-http,代碼行數:16,代碼來源:CliRequest.php

示例4:

 function IMDB_Request($url)
 {
     parent::__construct($url);
     if (PROXY != "") {
         $this->setConfig(array('proxy_host' => PROXY, 'proxy_port' => PROXY_PORT));
     }
     $this->setConfig('follow_redirects', false);
     $this->setHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
 }
開發者ID:chenrizhi,項目名稱:mtpt,代碼行數:9,代碼來源:imdb_config.php

示例5: __construct

 public function __construct($url, $method = AbstractClient::METHOD_GET, $config = array())
 {
     if (isset($config['dataType'])) {
         $this->_dataType = $config['dataType'];
         unset($config['dataType']);
     }
     $config['ssl_verify_peer'] = false;
     $config['ssl_verify_host'] = false;
     parent::__construct($url, $method, $config);
 }
開發者ID:mobilerider,項目名稱:mobilerider-client-php,代碼行數:10,代碼來源:Request.php

示例6: array

 function __construct($url = null, $method = self::METHOD_GET, array $config = array())
 {
     if (extension_loaded('curl') && strpos(@ini_get('disable_functions'), 'curl_exec') === false) {
         $this->setConfig('adapter', 'HTTP_Request2_Adapter_Curl');
     }
     $this->setConfig('proxy_host', Am_Di::getInstance()->config->get('http.proxy_host'));
     $this->setConfig('proxy_port', Am_Di::getInstance()->config->get('http.proxy_port'));
     $this->setConfig('proxy_user', Am_Di::getInstance()->config->get('http.proxy_user'));
     $this->setConfig('proxy_password', Am_Di::getInstance()->config->get('http.proxy_password'));
     $this->setConfig('ssl_verify_peer', Am_Di::getInstance()->config->get('http.verify_peer', false));
     $this->setConfig('ssl_verify_host', Am_Di::getInstance()->config->get('http.verify_host', false));
     $this->setConfig('ssl_cafile', Am_Di::getInstance()->config->get('http.ssl_cafile', null));
     $this->setConfig('ssl_cafile', Am_Di::getInstance()->config->get('http.ssl_cafile', null));
     parent::__construct($url, $method, $config);
 }
開發者ID:alexanderTsig,項目名稱:arabic,代碼行數:15,代碼來源:HttpRequest.php

示例7:

 function IMDB_Request($url)
 {
     parent::__construct($url);
     if (PROXY != "") {
         $this->setConfig(array('proxy_host' => PROXY, 'proxy_port' => PROXY_PORT));
     }
     $this->setConfig('follow_redirects', false);
     $this->setHeader('Host', '72.21.211.32');
     $this->setHeader('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8');
     $this->setHeader('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8');
     $this->setHeader('Accept-Language', 'en-us,en;q=0.5');
     $this->setHeader('Accept-Encoding', 'deflate');
     $this->setHeader('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7');
     $this->setHeader('Content-Type', 'application/x-www-form-urlencoded');
     $this->setHeader('Referer', '72.21.211.32');
 }
開發者ID:CptTZ,項目名稱:NexusPHP-1,代碼行數:16,代碼來源:imdb_config.php

示例8: array

 function __construct($url = null, $method = self::METHOD_GET, $config = array())
 {
     $this->config['max_redirs'] = 10;
     $this->config['follow_redirects'] = true;
     // We've had some issues with keepalive breaking with
     // HEAD requests, such as to youtube which seems to be
     // emitting chunked encoding info for an empty body
     // instead of not emitting anything. This may be a
     // bug on YouTube's end, but the upstream libray
     // ought to be investigated to see if we can handle
     // it gracefully in that case as well.
     $this->config['protocol_version'] = '1.0';
     // Default state of OpenSSL seems to have no trusted
     // SSL certificate authorities, which breaks hostname
     // verification and means we have a hard time communicating
     // with other sites' HTTPS interfaces.
     //
     // Turn off verification unless we've configured a CA bundle.
     if (common_config('http', 'ssl_cafile')) {
         $this->config['ssl_cafile'] = common_config('http', 'ssl_cafile');
     } else {
         $this->config['ssl_verify_peer'] = false;
     }
     if (common_config('http', 'curl') && extension_loaded('curl')) {
         $this->config['adapter'] = 'HTTP_Request2_Adapter_Curl';
     }
     parent::__construct($url, $method, $config);
     $this->setHeader('User-Agent', $this->userAgent());
 }
開發者ID:stevertiqo,項目名稱:StatusNet,代碼行數:29,代碼來源:httpclient.php

示例9: __construct

 /**
  * Default constructor - sets TYPO3 defaults
  *
  * @param string|\Net_Url2 $url Request URL
  * @param string $method Request Method (GET, HEAD or POST). Redirects reset this to GET unless "strict_redirects" is set.
  * @param array $config Configuration for this request instance
  * @link http://pear.php.net/manual/en/package.http.http-request2.config.php
  */
 public function __construct($url = NULL, $method = self::METHOD_GET, array $config = array())
 {
     parent::__construct($url, $method);
     $this->setConfiguration($config);
 }
開發者ID:khanhdeux,項目名稱:typo3test,代碼行數:13,代碼來源:HttpRequest.php

示例10: array

 function __construct($url = null, $method = self::METHOD_GET, $config = array())
 {
     $this->config['max_redirs'] = 10;
     $this->config['follow_redirects'] = true;
     // We've had some issues with keepalive breaking with
     // HEAD requests, such as to youtube which seems to be
     // emitting chunked encoding info for an empty body
     // instead of not emitting anything. This may be a
     // bug on YouTube's end, but the upstream libray
     // ought to be investigated to see if we can handle
     // it gracefully in that case as well.
     $this->config['protocol_version'] = '1.0';
     parent::__construct($url, $method, $config);
     $this->setHeader('User-Agent', $this->userAgent());
 }
開發者ID:sukhjindersingh,項目名稱:PHInest-Solutions,代碼行數:15,代碼來源:httpclient.php


注:本文中的HTTP_Request2::__construct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。