src/Service/Browser.php
protected function getBrowser()
    {
        if (!($this->browser instanceof Client)) {
            $this->browser = new Client($this->host);

            // try to set User-Agent from original request
            $user_agent = self::DEFAULT_USER_AGENT;
            if ($this->request) {
                $user_agent = $this->request->server->get('HTTP_USER_AGENT', self::DEFAULT_USER_AGENT);
            }
            $this->browser->setDefaultHeaders(['User-Agent' => $user_agent]);

            // configure browser client
            $this->browser->setDefaultOption('timeout', $this->timeout);
            if ($this->proxy_list) {
                $this->browser->setDefaultOption('proxy', $this->proxy_list[array_rand($this->proxy_list)]);
            }
        }

        return $this->browser;
    }
protected function getBrowser()
    {
        if (!($this->browser instanceof Client)) {
            $this->browser = new Client($this->host);

            // try to set User-Agent from original request
            $user_agent = self::DEFAULT_USER_AGENT;
            if ($this->request) {
                $user_agent = $this->request->server->get('HTTP_USER_AGENT', self::DEFAULT_USER_AGENT);
            }
            $this->browser->setDefaultHeaders(['User-Agent' => $user_agent]);

            // configure browser client
            $this->browser->setDefaultOption('timeout', $this->timeout);
            if ($this->proxy_list) {
                $this->browser->setDefaultOption('proxy', $this->proxy_list[array_rand($this->proxy_list)]);
            }
        }

        return $this->browser;
    }
protected function getBrowser ( ) { if ( ! ( $ this -> browser instanceof Client ) ) { $ this -> browser = new Client ( $ this -> host ) ; // try to set User-Agent from original request $ user_agent = self :: DEFAULT_USER_AGENT ; if ( $ this -> request ) { $ user_agent = $ this -> request -> server -> get ( 'HTTP_USER_AGENT' , self :: DEFAULT_USER_AGENT ) ; } $ this -> browser -> setDefaultHeaders ( [ 'User-Agent' => $ user_agent ] ) ; // configure browser client $ this -> browser -> setDefaultOption ( 'timeout' , $ this -> timeout ) ; if ( $ this -> proxy_list ) { $ this -> browser -> setDefaultOption ( 'proxy' , $ this -> proxy_list [ array_rand ( $ this -> proxy_list ) ] ) ; } } return $ this -> browser ; }
Get HTTP browser.

@param \Guzzle\Http\Client
Get HTTP browser .