------ UPDATED March 4, 2017 -------
I was there and found that the best solution was:
If you donβt have a dedicated server or at least vps and a little patience, donβt worry about reading the rest of the post ...
1 - Install Squid 3.2 from the source code (see notes below)
2 - Add a list of 20 or so ip to squid.conf (costs about $ 25 per month)
3 - Use the new ACLrandom feature to rotate outbound IP.
Thus, you do not need to rotate the ip list in your php script, instead you will connect to the same ip (for example: 192.168.1.1{ tcp_outgoing_address ), but the visible outgoing ip ( tcp_outgoing_address ) will rotate with each request based on random settings .
You will need to compile squid 3.2 with '-enable-http-violations' to make it an elite anonymous proxy.
Step-by-step installation:
yum -y groupinstall 'Development Tools' yum -y install openssl-devel wget http://www.squid-cache.org/Versions/v3/3.2/squid-3.2.13.tar.gz tar -xvf squid-3.2.13.tar.gz cd squid-3.2.13 ./configure -prefix=/squid32 '--enable-removal-policies=heap,lru' '--enable-ssl' '--with-openssl' '--enable-linux-netfilter' '--with-pthreads' '--enable-ntlm-auth-helpers=SMB,fakeauth' '--enable-external-acl-helpers=ip_user,ldap_group,unix_group,wbinfo_group' '--enable-auth-basic' '--enable-auth-digest' '--enable-auth-negotiate' '--enable-auth-ntlm' '--with-winbind-auth-challenge' '--enable-useragent-log' '--enable-referer-log' '--disable-dependency-tracking' '--enable-cachemgr-hostname=localhost' '--enable-underscores' '--enable-build-info' '--enable-cache-digests' '--enable-ident-lookups' '--enable-follow-x-forwarded-for' '--enable-wccpv2' '--enable-fd-config' '--with-maxfd=16384' '-enable-http-violations' make make install
Squid.conf example (found in this case /squid32/etc/squid.conf):
An example PHP CURL request using squid proxy:
$proxy = "1.1.1.1:33333"; $useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"; $url = "https://api.ipify.org/"; $ch = curl_init(); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,15); curl_setopt($ch, CURLOPT_HTTP_VERSION,'CURL_HTTP_VERSION_1_1' ); curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); curl_setopt($ch, CURLOPT_PROXY, $proxy); curl_setopt($ch, CURLOPT_PROXYUSERPWD,'USER:PASS'); curl_setopt($ch, CURLOPT_USERAGENT,$useragent); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0); $result=curl_exec ($ch); curl_close ($ch); echo $result
Useful links:
Squid 3.2 Source : http://www.squid-cache.org/Versions/v3/3.2/squid-3.2.13.tar.gz
Rotating_three_IPs : http://wiki.squid-cache.org/ConfigExamples/Strange/RotatingIPs#Example:_Rotating_three_IPs_based_on_time_of_day
AclRandom : http://wiki.squid-cache.org/Features/AclRandom
Installing Squid 3.2 on CentOS 5.3 - http://www.guldmyr.com/blog/installing-squid-3-2-on-centos-5-3/
Add a password to Squid : How to configure a Squid proxy server with basic authentication by username and password?
I believe that this is the most reliable and safe way of alternating proxies, since you do not rely on third-party proxies and your information (passwords, data, etc.) will be more secure. At first, this may seem a little complicated to set up, but every second spent will pay off, GL :)