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

Author: bpeh

Bernard Peh is a great passioner of web technologies and one of the co-founder of Sitecritic.net Website Design and Reviews. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP programming.