本文整理汇总了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');
}
示例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');
}
示例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);
}
示例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)");
}
示例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);
}
示例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);
}
示例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');
}
示例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());
}
示例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);
}
示例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());
}