PicoFeed\Client\Curl::prepareProxyContext PHP Method

prepareProxyContext() private method

Prepare curl proxy context.
private prepareProxyContext ( resource $ch ) : resource
$ch resource
return resource $ch
    private function prepareProxyContext($ch)
    {
        if ($this->proxy_hostname) {
            Logger::setMessage(get_called_class() . ' Proxy: ' . $this->proxy_hostname . ':' . $this->proxy_port);
            curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxy_port);
            curl_setopt($ch, CURLOPT_PROXYTYPE, 'HTTP');
            curl_setopt($ch, CURLOPT_PROXY, $this->proxy_hostname);
            if ($this->proxy_username) {
                Logger::setMessage(get_called_class() . ' Proxy credentials: Yes');
                curl_setopt($ch, CURLOPT_PROXYUSERPWD, $this->proxy_username . ':' . $this->proxy_password);
            } else {
                Logger::setMessage(get_called_class() . ' Proxy credentials: No');
            }
        }
        return $ch;
    }