'', 'curl_options' => array() ); /** * Handle instantiation. * * In addition to performing the normal Solar construction, this checks to * insure that the cURL extension is loaded. * * @param array|null * @return void */ public function __construct($config = null) { parent::__construct($config); // throw an exception if cURL extension is not loaded if (!extension_loaded('curl')) { throw $this->_exception( 'ERR_EXTENSION_NOT_LOADED', array($this->_config) ); } } /** * Verifies the {@link $_handle} and {@link $_passwd} against the config * value's url to insure the credentials provided are correct. * * @return boolean * @access protected */ protected function _verify() { $url = $this->_config['url']; // throw an exception if $url has not been set by config or a sub-class if (empty($url)) { throw $this->_exception( 'Curl Authorization Error: url config value not set', array($this->_config) ); } // Instantiate cURL $curl = curl_init($url); // Set all options as specified in config value foreach ($this->_config['curl_options'] as $name => $value) { curl_setopt($curl, $name, $value); } // set username/password and execute curl_setopt($curl, CURLOPT_USERPWD, "{$this->_handle}:{$this->_passwd}"); $result = curl_exec($curl); if (curl_getinfo($curl, CURLINFO_HTTP_CODE) == 200) { return true; } // attempt parent::_verify() as this has failed return parent::_verify(); } } ?>