3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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)]; } }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.2.90.1350.01014.12
7.2.80.1080.01014.01
7.2.70.0810.00014.53
7.2.60.0820.00714.34
7.2.50.1220.01014.57
7.2.40.0620.01116.12
7.2.30.0800.01116.05
7.2.20.0490.01017.10
7.2.10.0430.00817.21
7.2.00.0570.01017.28
7.1.210.1220.00713.50
7.1.200.0890.00313.57
7.1.190.1040.00613.54
7.1.180.1240.00313.53
7.1.170.1610.00313.09
7.1.160.0420.00914.94
7.1.150.0560.00914.71
7.1.140.0500.01015.92
7.1.130.0600.01116.01
7.1.120.0730.01116.11
7.1.110.0500.00915.59
7.1.100.0560.01115.59
7.1.90.0570.01115.68
7.1.80.0520.00615.71
7.1.70.0520.00615.25
7.1.60.0620.01333.39
7.1.50.0640.01133.10
7.1.40.0600.01232.72
7.1.30.0560.01232.88
7.1.20.1000.01532.99
7.1.10.0450.01114.83
7.1.00.0420.01014.87
7.0.310.1160.00713.05
7.0.300.0780.00713.09
7.0.290.0490.00914.78
7.0.280.1270.00713.08
7.0.270.0480.00815.80
7.0.260.0510.00615.83
7.0.250.0460.00815.48
7.0.240.0530.01015.47
7.0.230.0480.00815.58
7.0.220.0440.00915.42
7.0.210.0310.01014.70
7.0.200.0410.00614.79
7.0.190.0410.01214.72
7.0.180.0580.01114.49
7.0.170.0570.00814.52
7.0.160.0410.01114.37
7.0.150.0510.00914.45
7.0.140.0430.00714.60
7.0.130.0350.00914.62
7.0.120.0410.00814.69
7.0.110.0380.00814.55
7.0.100.0350.00914.50
7.0.90.0510.01014.49
7.0.80.0320.01014.59
7.0.70.0510.00914.71
7.0.60.0490.01014.41
7.0.50.0510.01114.73
7.0.40.0390.01214.71
7.0.30.0390.00814.62
7.0.20.0390.01314.66
7.0.10.0500.00814.72
7.0.00.0420.00814.71
hhvm-3.22.00.0960.21791.11
hhvm-3.21.30.1040.19790.36
hhvm-3.21.00.0930.19589.75
hhvm-3.20.20.1000.18690.32
hhvm-3.19.20.0940.20089.81
hhvm-3.18.50.1000.20688.73
hhvm-3.18.40.1030.19888.26
hhvm-3.17.30.0890.18387.92
hhvm-3.15.40.0900.20385.49
hhvm-3.13.20.1260.19096.64
hhvm-3.12.140.0930.19095.77
hhvm-3.11.10.1080.20887.93
hhvm-3.10.10.1080.19884.86
5.6.300.0170.04218.55
5.6.290.0160.05118.63
5.6.280.0100.04418.54
5.6.270.0140.04818.57
5.6.260.0170.04018.45
5.6.250.0150.05018.63
5.6.240.0120.04818.61
5.6.230.0190.04018.58
5.6.220.0140.05018.49
5.6.210.0180.04518.44
5.6.200.0160.04918.59
5.6.190.0150.04318.56
5.6.180.0200.05018.56
5.6.170.0130.04518.53
5.6.160.0150.05118.52
5.6.150.0200.05418.56
5.6.140.0130.04818.60
5.6.130.0160.04918.69
5.6.120.0160.04518.61
5.6.110.0150.05118.59
5.6.100.0150.04618.76
5.6.90.0150.04318.50
5.6.80.0110.04918.21
5.6.70.0160.03718.08
5.6.60.0130.04818.15
5.6.50.0170.04618.04
5.6.40.0180.05218.04
5.6.30.0170.04518.05
5.6.20.0130.04418.15
5.6.10.0130.04018.01
5.6.00.0130.04518.10
5.5.380.0160.03815.28
5.5.370.0150.04715.30
5.5.360.0140.04115.32
5.5.350.0150.03815.20
5.5.340.0180.04515.57
5.5.330.0130.04315.62
5.5.320.0140.03915.58
5.5.310.0170.04415.55
5.5.300.0170.04715.61
5.5.290.0170.05015.61
5.5.280.0160.04615.55
5.5.270.0170.04515.68
5.5.260.0140.05015.62
5.5.250.0120.04215.28
5.5.240.0130.03915.14
5.5.230.0130.04015.26
5.5.220.0110.04615.15
5.5.210.0120.03915.14
5.5.200.0150.04015.17
5.5.190.0150.04415.05
5.5.180.0160.04215.07
5.5.170.0140.00814.12
5.5.160.0140.03715.14
5.5.150.0110.04515.01
5.5.140.0120.04015.10
5.5.130.0100.03815.11
5.5.120.0140.04115.05
5.5.110.0120.04415.04
5.5.100.0170.05115.06
5.5.90.0120.04615.10
5.5.80.0140.04315.16
5.5.70.0160.04015.09
5.5.60.0150.04615.06
5.5.50.0120.04715.08
5.5.40.0120.04315.12
5.5.30.0150.04314.92
5.5.20.0140.04915.07
5.5.10.0150.04615.05
5.5.00.0150.03814.85
5.4.450.0140.05216.64
5.4.440.0180.05216.61
5.4.430.0120.04316.41
5.4.420.0120.05016.56
5.4.410.0130.03916.52
5.4.400.0160.04816.22
5.4.390.0130.03916.18
5.4.380.0140.03616.31
5.4.370.0120.04316.16
5.4.360.0130.04516.27
5.4.350.0170.04116.05
5.4.340.0150.03816.44
5.4.330.0040.00710.77
5.4.320.0120.04616.28
5.4.310.0120.04316.21
5.4.300.0160.04516.19
5.4.290.0150.03516.25
5.4.280.0140.04516.18
5.4.270.0160.03816.26
5.4.260.0130.04616.19
5.4.250.0170.04316.14
5.4.240.0160.05316.34
5.4.230.0150.04316.20
5.4.220.0140.04716.20
5.4.210.0130.04716.30
5.4.200.0160.05016.16
5.4.190.0160.04616.29
5.4.180.0160.03616.33
5.4.170.0160.03816.26
5.4.160.0140.04916.21
5.4.150.0140.04616.19
5.4.140.0160.04114.66
5.4.130.0120.04414.58
5.4.120.0070.04314.75
5.4.110.0120.04314.69
5.4.100.0120.04014.64
5.4.90.0140.04014.63
5.4.80.0150.04714.66
5.4.70.0120.04514.52
5.4.60.0110.04314.75
5.4.50.0140.04714.69
5.4.40.0110.04414.70
5.4.30.0140.03814.49
5.4.20.0170.03914.62
5.4.10.0110.04614.59
5.4.00.0140.04014.38
5.3.290.0140.04413.48
5.3.280.0130.04313.25
5.3.270.0120.04613.36
5.3.260.0160.04313.36
5.3.250.0150.04113.25
5.3.240.0130.04013.36
5.3.230.0120.04313.41
5.3.220.0130.04313.33
5.3.210.0150.04413.33
5.3.200.0090.04013.41
5.3.190.0130.04713.28
5.3.180.0140.04713.33
5.3.170.0150.04113.31
5.3.160.0110.04313.31
5.3.150.0170.04513.27
5.3.140.0130.04413.40
5.3.130.0160.03513.37
5.3.120.0110.04713.36
5.3.110.0130.05313.32
5.3.100.0110.03813.04
5.3.90.0140.04313.00
5.3.80.0160.04412.87
5.3.70.0110.04312.83
5.3.60.0120.03813.00
5.3.50.0120.03912.93
5.3.40.0140.04012.86
5.3.30.0130.03312.86
5.3.20.0090.04112.69
5.3.10.0090.04212.73
5.3.00.0100.04312.72
5.2.170.0130.03011.12
5.2.160.0070.03711.04
5.2.150.0110.03510.90
5.2.140.0110.03611.02
5.2.130.0090.03210.94
5.2.120.0070.02910.92
5.2.110.0120.03311.06
5.2.100.0100.03211.07
5.2.90.0100.02710.88
5.2.80.0090.03511.00
5.2.70.0110.03311.04
5.2.60.0080.03711.00
5.2.50.0100.03511.02
5.2.40.0080.03410.99
5.2.30.0110.03110.97
5.2.20.0070.03310.81
5.2.10.0100.03810.85
5.2.00.0090.03410.77
5.1.60.0100.02310.39
5.1.50.0060.02810.15
5.1.40.0100.03110.25
5.1.30.0120.03010.45
5.1.20.0140.03110.44
5.1.10.0110.03310.28
5.1.00.0100.02910.33
5.0.50.0100.0239.53
5.0.40.0100.0199.53
5.0.30.0070.0309.53
5.0.20.0070.0259.53
5.0.10.0060.0249.53
5.0.00.0070.0379.53
4.4.90.0080.0179.53
4.4.80.0060.0179.53
4.4.70.0070.0179.53
4.4.60.0050.0169.53
4.4.50.0070.0189.53
4.4.40.0030.0309.53
4.4.30.0070.0169.53
4.4.20.0050.0229.53
4.4.10.0060.0189.53
4.4.00.0080.0219.53
4.3.110.0040.0209.53
4.3.100.0040.0179.53
4.3.90.0060.0179.53
4.3.80.0070.0279.53
4.3.70.0060.0209.53
4.3.60.0060.0199.53
4.3.50.0050.0189.53
4.3.40.0090.0259.53
4.3.30.0050.0189.53
4.3.20.0050.0179.53
4.3.10.0040.0219.53
4.3.00.0030.0209.53