Пример #1
0
 public function open()
 {
     if (HTTP::urlExists($this->config('target'))) {
         $target = parse_url($this->config('target'));
         $status = '';
         $this->_host = $target['host'] ? $target['host'] : HTTP::domain();
         $this->_url = $target['path'];
         $port = $target['port'] ? $target['port'] : $this->config('port');
         $this->_connection = fsockopen($host, $port, $error_number, $error_string, 30);
         $status($this->_connection) ? self::STATUS_CONNECTED : $error_string . ': ' . $error_number;
     } else {
         $status = self::STATUS_NOTCONNECTED;
     }
     $this->status($status);
 }
Пример #2
0
 public function open()
 {
     $target = $this->config('target') ? $this->config('target') : HTTP::domain();
     $method = $this->config('method');
     $header = $this->config('header');
     $wrapper = $this->config('wrapper');
     if (HTTP::urlExists($target)) {
         $options = array($wrapper => array('header' => $header, 'method' => $method));
         $this->_connection = stream_context_create($options);
         $status = $this->_connection ? self::STATUS_CONNECTED : self::STATUS_NOTCONNECTED;
     } else {
         $status = self::STATUS_NOTCONNECTED;
     }
     $this->status($status);
 }
Пример #3
0
 public function open()
 {
     $status = '';
     $target = $this->config('target') ? $this->config('target') : HTTP::domain();
     $refresh = (bool) $this->config('refresh');
     if (!$this->config('validate_host') || HTTP::urlExists($target)) {
         $data = $this->_data;
         //open connection
         $this->_connection = curl_init();
         curl_setopt($this->_connection, CURLOPT_URL, $target);
         curl_setopt($this->_connection, CURLOPT_COOKIESESSION, $refresh);
         if ($this->config('username') && $this->config('password')) {
             curl_setopt($this->_connection, CURLOPT_USERPWD, $this->config('username') . ':' . $this->config('password'));
         }
         $status = $this->_connection ? self::STATUS_CONNECTED : self::STATUS_NOTCONNECTED;
     } else {
         $status = self::STATUS_NOTCONNECTED;
     }
     $this->status($status);
 }