Beispiel #1
0
 /**
  * Extends parent constructor to detect availability of cURL
  *
  * @param   string  $resource
  * @param   array   $options
  * @throws  \RuntimeException
  */
 public function __construct($resource, array $options)
 {
     // check if we have libcurl available
     if (!class_exists('SoapClient')) {
         throw new \RuntimeException('Your PHP installation doesn\'t have Soap enabled. Rebuild PHP with --enable-soap');
     }
     logger(\Fuel::L_INFO, 'Creating a new SOAP Request with URI = "' . $resource . '"', __METHOD__);
     // If authentication is enabled use it
     if (!empty($options['user']) and !empty($options['pass'])) {
         $this->set_option('login', $options['user']);
         $this->set_option('password', $options['pass']);
     }
     // WSDL-mode only options
     if (!empty($resource)) {
         foreach (static::$wsdl_settings as $setting) {
             isset($options[$setting]) and $this->set_option($setting, $options[$setting]);
         }
     } else {
         $resource = null;
         if (!isset($options['location']) or !isset($options['uri'])) {
             throw new \RequestException('The keys "location" and "uri" are required in non-WSDL mode.');
         }
         foreach (static::$non_wsdl_settings as $setting) {
             isset($options[$setting]) and $this->set_option($setting, $options[$setting]);
         }
     }
     foreach (static::$generic_settings as $setting) {
         isset($options[$setting]) and $this->set_option($setting, $options[$setting]);
     }
     // make it always throw exceptions
     $this->set_option('exceptions', true);
     parent::__construct($resource, $options);
 }
Beispiel #2
0
 /**
  * Extends parent constructor to detect availability of cURL
  *
  * @param   string  $resource  url to use
  * @param   array   $options   options array
  * @param   string  $method    request method
  * @throws  \RuntimeException
  */
 public function __construct($resource, array $options, $method = null)
 {
     // check if we have libcurl available
     if (!function_exists('curl_init')) {
         throw new \RuntimeException('Your PHP installation doesn\'t have cURL enabled. Rebuild PHP with --with-curl');
     }
     logger(\Fuel::L_INFO, 'Creating a new CURL Request with URI = "' . $resource . '"', __METHOD__);
     // If authentication is enabled use it
     if (!empty($options['auth']) and !empty($options['user']) and !empty($options['pass'])) {
         $this->http_login($options['user'], $options['pass'], $options['auth']);
     }
     parent::__construct($resource, $options, $method);
 }
Beispiel #3
0
 /**
  * Extends parent constructor to detect availability of cURL
  *
  * @param   string  $resource
  * @param   array   $options
  * @throws  \RuntimeException
  */
 public function __construct($resource, array $options)
 {
     // check if we have libcurl available
     if (!function_exists('curl_init')) {
         throw new \RuntimeException('Your PHP installation doesn\'t have cURL enabled. Rebuild PHP with --with-curl');
     }
     // If authentication is enabled use it
     if (!empty($options['auth']) and !empty($options['user']) and !empty($options['pass'])) {
         $this->http_login($options['user'], $options['pass'], $options['auth']);
     }
     // we want to handle failure ourselves
     $this->set_option('failonerror', false);
     parent::__construct($resource, $options);
 }