コード例 #1
0
ファイル: Proxy.php プロジェクト: bradley-holt/zf2
 /**
  * Connect to the remote server
  *
  * Will try to connect to the proxy server. If no proxy was set, will
  * fall back to the target server (behave like regular Socket adapter)
  *
  * @param string  $host
  * @param int     $port
  * @param boolean $secure
  */
 public function connect($host, $port = 80, $secure = false)
 {
     // If no proxy is set, fall back to Socket adapter
     if (!$this->config['proxy_host']) {
         return parent::connect($host, $port, $secure);
     }
     /* Url might require stream context even if proxy connection doesn't */
     if ($secure) {
         $this->config['sslusecontext'] = true;
     }
     // Connect (a non-secure connection) to the proxy server
     return parent::connect($this->config['proxy_host'], $this->config['proxy_port'], false);
 }
コード例 #2
0
 /**
  * Connect to the remote server
  *
  * @param string  $host
  * @param int     $port
  * @param boolean $secure
  * @param int     $timeout
  */
 public function connect($host, $port = 80, $secure = false)
 {
     $this->log("Connecting to: {$host}:{$port}");
     return parent::connect($host, $port, $secure);
 }