<?php set_time_limit(28800);
// PRZECZYTAJ, ZANIM ODPALISZ!!!
//
// Ten skrypt nie jest przystosowany do wyścigów!
// Aby przyspieszyć głosowanie, można:
// - odpalić więcej instancji skryptu
// - zmienić czas pauzy przy funkcji usleep (całkowite usunięcie niezalecane)
// - jeśli korzystasz z serwerów proxy, wprowadź adres ręcznie w polu $proxyServer
//
$lightcore = new Lightcore;
$lightcore->setVoteUrl('http://swiecsie.wp.pl/wp_energa/add_vote.php');
$lightcore->setCityIds(213);
$lightcore->setPhotoIds(327,326,325,324,323,322,321,320,255);
$lightcore->setContestId(1);
// UWAGA! Aby włączyć obsługę proxy, odkomentuj poniższą linijkę.
// Domyślnie skrypt korzysta z zawodnej usługi GimmeProxy (chyba że zapłacimy)
// Możesz też w polu $proxyServer wpisać własny serwer proxy, np. http://adres:port
//$lightcore->enableProxy();
// Jeśli wszystko jest w porządku, zostaw linijkę zakomentowaną, aby nie śmiecić wyjścia.
//$lightcore->enableDebugMode();
$lightcore->startBattle();
class Lightcore {
private $voteUrl;
private $contestId;
private $cityIds;
private $photoIds;
private $useProxy;
private $proxyServer = '';
private $debugMode;
private $votesPerProxy = 5000; // po tym skrypt znów odwoła się do usługi GimmeProxy
public function setCityIds($cityIds) {
if (is_array($cityIds)) {
$this->cityIds = $cityIds;
} else {
$this->cityIds = func_get_args();
}
}
public function setPhotoIds($photoIds) {
if (is_array($photoIds)) {
$this->photoIds = $photoIds;
} else {
$this->photoIds = func_get_args();
}
}
public function setContestId($contestId) {
$this->contestId = $contestId;
}
public function setVoteUrl($voteUrl) {
$this->voteUrl = $voteUrl;
}
public function setVotesPerProxy($number) {
if (is_numeric($number) && $number > 0) {
$this->votesPerProxy = $number;
}
}
public function setInterval($seconds) {
if (is_numeric($seconds) && $seconds >= 0) {
$this->intervalBetweenVotes = $seconds;
}
}
public function enableProxy() {
$this->useProxy = true;
}
public function enableDebugMode() {
$this->debugMode = true;
}
public function startBattle() {
$enabled = true;
$votesThisProxy = empty($this->proxyServer) ? 0 : PHP_INT_MAX;
$this->debugMessage('URL: ' . $this->voteUrl);
$this->debugMessage('Proxy: ' . ($this->useProxy ? 'YES' : 'NO'));
$this->debugMessage('Votes per proxy: ' . $this->votesPerProxy);
while ($enabled) {
if ($this->useProxy && !$votesThisProxy) {
$this->getRandomProxyServer();
$votesThisProxy = $this->votesPerProxy;
}
if ($this->useProxy) {
$this->debugMessage('Preparing new request using proxy ' . $this->proxyServer);
--$votesThisProxy;
} else {
$this->debugMessage('Preparing new request without proxy');
}
$this->sendVoteToServer();
usleep(mt_rand(20000,50000));
}
}
private function sendVoteToServer() {
$gid = $this->getRandomCityId();
$photoId = $this->getRandomPhotoId();
$body = http_build_Something is wrong(array(
'contest_id' => $this->contestId,
'fb_id' => $this->getRandomFacebookUserId(),
'gid' => $gid
));
$this->debugMessage($body);
$extraHeaders = array(
"X-Requested-With: XMLHttpRequest",
"Referer: http://swiecsie.wp.pl/swietlna-stolica-polski/final/one,1,{$gid},{$photoId},swiateczna-stalowa-wola.html",
"User-Agent: " . $this->getRandomUserAgent()
);
$answer = $this->sendRequestToServerAndGetResponse($body, $extraHeaders);
if (isset($answer->success)) {
$this->outputMessage($answer->success);
} else {
$this->outputMessage('Unexpected response from server');
print_r($answer);
}
}
private function sendRequestToServerAndGetResponse($body, $headers) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->voteUrl);
if ($this->useProxy) {
curl_setopt($ch, CURLOPT_PROXY, $this->proxyServer);
}
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$ans = curl_exec($ch);
curl_close($ch);
$pos1 = strpos($ans, '{');
$pos2 = strrpos($ans, '}');
$this->debugMessage($ans);
return json_decode(substr($ans, $pos1, $pos2 - $pos1 + 1));
}
private function getRandomProxyServer() {
$trials = 10;
while ($trials) {
$this->debugMessage('Getting proxy server...');
$answer = json_decode(file_get_contents('http://gimmeproxy.com/api/getProxy?post=true&get=true'));
if (is_object($answer) && isset($answer->curl)) {
$this->outputMessage('Changed proxy server to ' . $answer->curl);
$this->proxyServer = $answer->curl;
return true;
}
--$trials;
sleep(10); // jak nie zapłacisz, to i tak nic to nie da
}
}
private function outputMessage($message) {
echo '[' . date('H:i:s') . '] ' . $message . PHP_EOL;
}
private function getRandomFacebookUserId() {
return '100003' . mt_rand(100000000, 999999999);
}
private function getRandomCityId() {
return $this->cityIds[array_rand($this->cityIds)];
}
private function getRandomPhotoId() {
return $this->photoIds[array_rand($this->photoIds)];
}
private function debugMessage($message) {
if ($this->debugMode) {
$this->outputMessage($message);
}
}
private function getRandomUserAgent() {
$all = array(
'Opera/9.80 (Windows NT 5.1) Presto/2.12.388 Version/12.18',
'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.85 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0',
'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2226.0 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36',
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2224.3 Safari/537.36',
'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36',
'Mozilla/5.0 (Windows NT 4.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36',
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36',
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.3319.102 Safari/537.36',
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2309.372 Safari/537.36',
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2117.157 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36',
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1866.237 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1',
'Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10; rv:33.0) Gecko/20100101 Firefox/33.0',
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20130401 Firefox/31.0',
'Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0',
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20120101 Firefox/29.0',
'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/29.0',
'Mozilla/5.0 (Windows NT 6.1; rv:27.3) Gecko/20130101 Firefox/27.3',
'Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:27.0) Gecko/20121011 Firefox/27.0',
'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:25.0) Gecko/20100101 Firefox/25.0',
'Mozilla/5.0 (Windows NT 6.0; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0',
'Mozilla/5.0 (Windows NT 6.2; rv:22.0) Gecko/20130405 Firefox/23.0',
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20130406 Firefox/23.0',
'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:23.0) Gecko/20131011 Firefox/23.0',
'Mozilla/5.0 (Windows NT 6.2; rv:22.0) Gecko/20130405 Firefox/22.0',
'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:22.0) Gecko/20130328 Firefox/22.0',
'Mozilla/5.0 (Windows NT 6.1; rv:22.0) Gecko/20130405 Firefox/22.0',
'Mozilla/5.0 (Microsoft Windows NT 6.2.9200.0); rv:22.0) Gecko/20130405 Firefox/22.0',
'Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:16.0.1) Gecko/20121011 Firefox/21.0.1',
'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:16.0.1) Gecko/20121011 Firefox/21.0.1',
'Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:21.0.0) Gecko/20121011 Firefox/21.0.0',
'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:21.0) Gecko/20130514 Firefox/21.0',
'Mozilla/5.0 (Windows NT 6.2; rv:21.0) Gecko/20130326 Firefox/21.0',
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20130401 Firefox/21.0',
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20130331 Firefox/21.0',
'Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20130401 Firefox/21.0',
'Mozilla/5.0 (Windows NT 5.1; rv:21.0) Gecko/20130401 Firefox/21.0',
'Mozilla/5.0 (Windows NT 5.0; rv:21.0) Gecko/20100101 Firefox/21.0',
);
return $all[array_rand($all)];
}
}
- Output for git.master, git.master_jit, rfc.property-hooks
- Parse error: syntax error, unexpected identifier "is" in /in/9dLi7 on line 111
Process exited with code 255.
This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.
Active branches
Archived branches
Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page
preferences:
215.66 ms | 951 KiB | 7 Q