__construct() public method

Constructor method. Will create a new HTTP client. Accepts the target URL and optionally configuration array.
public __construct ( Zend_Uri_Http | string $uri = null, array $config = null )
$uri Zend_Uri_Http | string
$config array Configuration key-value pairs.
Exemplo n.º 1
0
 /**
  * Constructs Object with Server URL and Configs
  *
  * @param array
  */
 public function __construct($array = false)
 {
     if ($array != false) {
         $this->setTestMode($array[0]);
     }
     parent::__construct($this->getServerUrl(), $this->getConfig());
 }
 /**
  * the constructor
  *
  * @param string $_uri the url to connect to
  * @param array $_config see Zend_Http_Client for details
  */
 public function __construct($_baseUri, array $_config = array())
 {
     $this->_baseUri = $_baseUri;
     $_config['useragent'] = 'PHP ajam remote client (rev: 0.2)';
     $_config['keepalive'] = TRUE;
     parent::__construct($_baseUri, $_config);
     // enable cookie handling
     $this->setCookieJar();
 }
Exemplo n.º 3
0
 /**
  * Constructor; creates a new HTTP Client instance which itself is
  * just a typical Zend_Http_Client subclass with some OAuth icing to
  * assist in automating OAuth parameter generation, addition and
  * cryptographioc signing of requests.
  *
  * @param array $oauthOptions
  * @param string $uri
  * @param array|Zend_Config $config
  * @return void
  */
 public function __construct(array $oauthOptions, $uri = null, $config = null)
 {
     parent::__construct($uri, $config);
     $this->_config = new Zend_Oauth_Config();
     if (!is_null($oauthOptions)) {
         if ($oauthOptions instanceof Zend_Config) {
             $oauthOptions = $oauthOptions->toArray();
         }
         $this->_config->setOptions($oauthOptions);
     }
 }
Exemplo n.º 4
0
 function __construct($username = null, $password = null)
 {
     parent::__construct();
     //magic headers for kinopoisk
     $this->setHeaders("Host", "www.kinopoisk.ru:80");
     $this->setHeaders("Accept", "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg");
     $config['maxredirects'] = 5;
     $config['timeout'] = 300;
     $config['useragent'] = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 FirePHP/0.4';
     $this->setConfig($config);
 }
Exemplo n.º 5
0
 /**
  * Constructor; creates a new HTTP Client instance which itself is
  * just a typical Zend_Http_Client subclass with some OAuth icing to
  * assist in automating OAuth parameter generation, addition and
  * cryptographioc signing of requests.
  *
  * @param  array $oauthOptions
  * @param  string $uri
  * @param  array|Zend_Config $config
  * @return void
  */
 public function __construct($oauthOptions, $uri = null, $config = null)
 {
     if (!isset($config['rfc3986_strict'])) {
         $config['rfc3986_strict'] = true;
     }
     parent::__construct($uri, $config);
     $this->_config = new Zend_Oauth_Config();
     if ($oauthOptions !== null) {
         if ($oauthOptions instanceof Zend_Config) {
             $oauthOptions = $oauthOptions->toArray();
         }
         $this->_config->setOptions($oauthOptions);
     }
 }
Exemplo n.º 6
0
 /**
  * Constructor method
  *
  * Expects a configuration parameter.
  *
  * @param Enlight_Config $config
  */
 public function __construct($config)
 {
     if (!empty($config->paypalSandbox)) {
         $url = self::URL_SANDBOX;
     } else {
         $url = self::URL_LIVE;
     }
     $this->apiUsername = $config->get('paypalUsername');
     $this->apiPassword = $config->get('paypalPassword');
     $this->apiSignature = $config->get('paypalSignature');
     $this->apiVersion = $config->get('paypalVersion');
     parent::__construct($url);
     $this->setAdapter(RestClient::createAdapterFromConfig($config));
 }
Exemplo n.º 7
0
 /**
  * Constructor; creates a new HTTP Client instance which itself is
  * just a typical Zend_Http_Client subclass with some OAuth icing to
  * assist in automating OAuth parameter generation, addition and
  * cryptographioc signing of requests.
  *
  * @param  array|Zend_Config $oauthOptions
  * @param  string            $uri
  * @param  array|Zend_Config $config
  * @return void
  */
 public function __construct($oauthOptions, $uri = null, $config = null)
 {
     if ($config instanceof Zend_Config && !isset($config->rfc3986_strict)) {
         $config                   = $config->toArray();
         $config['rfc3986_strict'] = true;
     } else if (null === $config ||
                (is_array($config) && !isset($config['rfc3986_strict']))) {
         $config['rfc3986_strict'] = true;
     }
     parent::__construct($uri, $config);
     $this->_config = new Zend_Oauth_Config;
     if ($oauthOptions !== null) {
         if ($oauthOptions instanceof Zend_Config) {
             $oauthOptions = $oauthOptions->toArray();
         }
         $this->_config->setOptions($oauthOptions);
     }
 }
Exemplo n.º 8
0
 public function __construct($uri = null, $config = null)
 {
     $this->config['useragent'] = 'Varien_Http_Client';
     parent::__construct($uri, $config);
 }
Exemplo n.º 9
0
 /**
  * コンストラクタ
  *
  * @param Zend_Uri_Http|string $uri
  * @param array $config Configuration key-value pairs.
  */
 public function __construct($uri = null, $config = null)
 {
     parent::__construct($uri, $config);
 }
Exemplo n.º 10
0
 /**
  * Constructor method
  * 
  * Expects a configuration parameter.
  *
  * @param Enlight_Config $config
  */
 public function __construct($config)
 {
     if(!empty($config->paypalSandbox)) {
         $url = self::URL_SANDBOX;
     } else {
         $url = self::URL_LIVE;
     }
     $this->apiUsername = $config->get('paypalUsername');
     $this->apiPassword = $config->get('paypalPassword');
     $this->apiSignature = $config->get('paypalSignature');
     $this->apiVersion = $config->get('paypalVersion');
     parent::__construct($url, array(
         'useragent' => 'Shopware/' . Shopware()->Config()->Version,
         'timeout' => 5,
     ));
     if (extension_loaded('curl')) {
         $adapter = new Zend_Http_Client_Adapter_Curl();
         $adapter->setCurlOption(CURLOPT_SSL_VERIFYPEER, false);
         $adapter->setCurlOption(CURLOPT_SSL_VERIFYHOST, false);
         $this->setAdapter($adapter);
     }
 }
 /**
  * Constructor method
  *
  * Expects a configuration parameter.
  *
  * @param Enlight_Config $config
  */
 public function __construct($config)
 {
     $this->pluginConfig = $config;
     parent::__construct($this->getBaseUri());
     $this->setAdapter(self::createAdapterFromConfig($config));
 }
Exemplo n.º 12
0
 public function __construct($baseApiUrl)
 {
     parent::__construct();
     $this->_baseApiUrl = $baseApiUrl;
     $this->assignApiKey()->assignTenant();
 }
Exemplo n.º 13
0
 /**
  * Initializes Zend_Http_Client connection.
  *
  * @param   string  $base       api url
  * @param   integer $timeout    connection timeout
  * @param   string  $useragent  client user-agent
  */
 public function __construct($base, $timeout = 10, $useragent = 'jirafe-php-client')
 {
     $this->_base = rtrim($base, '/') . '/';
     $config = array('useragent' => $useragent, 'timeout' => $timeout);
     parent::__construct($this->_base, $config);
 }
Exemplo n.º 14
0
 /**
  * @param null|\Zend_Uri_Http|string $uri
  * @param null|array $config
  */
 public function __construct($uri = null, $config = null)
 {
     $this->config['useragent'] = 'Magento\\Framework\\HTTP\\ZendClient';
     parent::__construct($uri, $config);
 }