Q: How can I use the proxies with PHP’s curl? A: <?php $ch = curl_init(‘https://bing.com’); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_PROXY, ‘proxyIP:proxyPass’); curl_setopt($ch, CURLOPT_PROXYUSERPWD, ‘proxyUser:proxyPass’); //if you have socks proxies curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); //if you have http proxies curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); echo ‘exec=’ . curl_exec($ch); ?>
Articles Tagged: curl
How do I use the proxies with cURL from the Linux’s terminal
If you need to use cURL with proxies which require authentication: curl –proxy-user proxyuser:proxypassword –proxy 1.2.3.4:80 http://mydomain.com