php curl proxy settings

It can be daunting to get proxy to work in curl. If it is not working for you, try changing the auth to ntlm.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘http://yoururl.com’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_PROXY , “your_proxy_ip:proxy_port”);
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch,CURLOPT_PROXYUSERPWD,”user:pass”);

curl_exec ($ch);

if(curl_errno($ch))
{
echo ‘Curl error: ‘ . curl_error($ch);
exit;
}

curl_close ($ch);

Like it.? Share it:

Comments are closed.