seregazhuk\PinterestBot\Api\CurlHttpClient::useProxy PHP Method

useProxy() public method

public useProxy ( string $host, string $port, string $auth = null, string $type = null ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient
$host string '192.168.1.1'
$port string '12345'
$auth string Authentication string: 'username:password'
$type string HTTP|SOCKS
return seregazhuk\PinterestBot\Api\Contracts\HttpClient
    public function useProxy($host, $port, $auth = null, $type = null)
    {
        $proxy = [CURLOPT_PROXY => $host, CURLOPT_PROXYPORT => $port, CURLOPT_PROXYTYPE => $type ? $type : CURLPROXY_HTTP];
        if ($auth) {
            $proxy[CURLOPT_PROXYUSERPWD] = $auth;
        }
        return $this->setOptions($proxy);
    }