php - how to use curl with proxy -


this question has answer here:

i need access website php curl, must use proxy.

is there simple way set curl use proxy?

if there no simple way, other options available?

please supply code example

did searched on stackoverflow? might check answer how use curl via proxy?

or doesn't answer question?

$ch = curl_init(); curl_setopt($ch, curlopt_url, 'http://www.foo.bar'); curl_setopt($ch, curlopt_header, 1); curl_setopt($ch, curlopt_returntransfer, 1);  curl_setopt($ch, curlopt_proxyauth, curlauth_ntlm); curl_setopt($ch, curlopt_proxy, 'proxy:8080');     curl_setopt($ch, curlopt_proxyport, 8080);     curl_setopt($ch, curlopt_proxyuserpwd, 'domain\user:password');      curl_setopt($ch, curlopt_timeout, 20); curl_setopt($ch, curlopt_connecttimeout, 20); curl_setopt($ch, curlopt_referer, 'http://myreferer.com'); curl_setopt($ch, curlopt_useragent, 'mozilla...');  $result = curl_exec($ch); $info = curl_getinfo($ch); $error = curl_error($ch);  curl_close($ch); 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -