Beispiel #1
0
 /**
  * __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');
 }
Beispiel #2
0
 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');
 }
 /**
  * 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);
 }
Beispiel #4
0
 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)");
 }
 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);
 }
Beispiel #6
0
 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);
 }
Beispiel #7
0
 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');
 }
Beispiel #8
0
 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());
 }
Beispiel #9
0
 /**
  * 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);
 }
 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());
 }