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