Skip to content

Instantly share code, notes, and snippets.

@icambridge
Created January 18, 2012 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icambridge/1636095 to your computer and use it in GitHub Desktop.
Save icambridge/1636095 to your computer and use it in GitHub Desktop.
Proxy Loader
<?php
print "Start".PHP_EOL;
$proxyList = file_get_contents('proxylist.txt');
$proxyList = explode(PHP_EOL, $proxyList);
$userAgents = array("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7",
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)",
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)");
foreach ($proxyList as $proxy) {
list($proxyUrl,$proxyPort) = explode(':',$proxy);
$userAgent = $userAgents[array_rand($userAgents)];
print "Using ".$proxy.PHP_EOL;
$ch = curl_init();
curl_setopt($ch, CURLOPT_PROXY, $proxyUrl);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); // To use HTTP proxies change this to CURLPROXY_HTTP
curl_setopt($ch, CURLOPT_PROXYPORT, $proxyPort);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, "www.lemospet.com/photo_contest.php?vote=249");
//curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_exec($ch);
$sleep = (int) rand(30,50);
sleep($sleep);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment