authentication example

// cURL offers really easy proxy support.         $proxy = new WP_HTTP_Proxy();

        if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {

            curl_setopt( $handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP );
            curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() );
            curl_setopt( $handle, CURLOPT_PROXYPORT, $proxy->port() );

            if ( $proxy->use_authentication() ) {
                curl_setopt( $handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY );
                curl_setopt( $handle, CURLOPT_PROXYUSERPWD, $proxy->authentication() );
            }
        }

        $is_local   = isset( $parsed_args['local'] ) && $parsed_args['local'];
        $ssl_verify = isset( $parsed_args['sslverify'] ) && $parsed_args['sslverify'];
        if ( $is_local ) {
            /** This filter is documented in wp-includes/class-wp-http-streams.php */
            $ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify$url );
        } elseif ( ! $is_local ) {
            /** This filter is documented in wp-includes/class-wp-http.php */
            $ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify$url );
        }
return $this->username() . ':' . $this->password();
    }

    /** * Retrieve header string for proxy authentication. * * @since 2.8.0 * * @return string */
    public function authentication_header() {
        return 'Proxy-Authorization: Basic ' . base64_encode( $this->authentication() );
    }

    /** * Determines whether the request should be sent through a proxy. * * We want to keep localhost and the site URL from being sent through the proxy, because * some proxies can not handle this. We also have the constant available for defining other * hosts that won't be sent through the proxy. * * @since 2.8.0 * * @param string $uri URL of the request. * @return bool Whether to send the request through the proxy. */
Home | Imprint | This part of the site doesn't use cookies.