buildCookieHeader example

$parsed_args = wp_parse_args( $args$defaults );

        if ( isset( $parsed_args['headers']['User-Agent'] ) ) {
            $parsed_args['user-agent'] = $parsed_args['headers']['User-Agent'];
            unset( $parsed_args['headers']['User-Agent'] );
        } elseif ( isset( $parsed_args['headers']['user-agent'] ) ) {
            $parsed_args['user-agent'] = $parsed_args['headers']['user-agent'];
            unset( $parsed_args['headers']['user-agent'] );
        }

        // Construct Cookie: header if any cookies are set.         WP_Http::buildCookieHeader( $parsed_args );

        $parsed_url = parse_url( $url );

        $connect_host = $parsed_url['host'];

        $secure_transport = ( 'ssl' === $parsed_url['scheme'] || 'https' === $parsed_url['scheme'] );
        if ( ! isset( $parsed_url['port'] ) ) {
            if ( 'ssl' === $parsed_url['scheme'] || 'https' === $parsed_url['scheme'] ) {
                $parsed_url['port'] = 443;
                $secure_transport   = true;
            } else {
                
$parsed_args = wp_parse_args( $args$defaults );

        if ( isset( $parsed_args['headers']['User-Agent'] ) ) {
            $parsed_args['user-agent'] = $parsed_args['headers']['User-Agent'];
            unset( $parsed_args['headers']['User-Agent'] );
        } elseif ( isset( $parsed_args['headers']['user-agent'] ) ) {
            $parsed_args['user-agent'] = $parsed_args['headers']['user-agent'];
            unset( $parsed_args['headers']['user-agent'] );
        }

        // Construct Cookie: header if any cookies are set.         WP_Http::buildCookieHeader( $parsed_args );

        $handle = curl_init();

        // 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() );

            
Home | Imprint | This part of the site doesn't use cookies.