3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Author: Yash Gupta | File: search.php Complete code source and tutorial: http://thetechnofreak.com/technofreak/get-scrape-google-search-results-php/ Description: This script searches google for a given search term and outputs all the results' urls for up to 1000 results. Usage: Make a form in some other page and pass the following parameters with GET method, or modify the url as search.php?pages=50&q=get+google+results+php q => Your search query. Default query is: 'no query' pages => The number of pages you want to parse. (default is 10, maximum of 100) start => The page to start from. Default is 1 10/04/2012 mods/fixes/updates by Jay at http://he.tel */ echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Scrape Google Results with PHP</title> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> </head> <body>'; $input=rawurldecode($_GET["input-text"]); $keyword=trim(preg_replace("/\s\s+/", " ", $input)); if (isset($_GET["data"])){ echo "Your Search Term ==> <b>"; print_r(htmlspecialchars($keyword)); echo "</b><br><br><br>"; if(substr($_SERVER['DOCUMENT_ROOT'],0,2)==="C:"){ echo '<a href="http://localhost'.$_SERVER['PHP_SELF'].'">Reset Search</a>'; }else{ echo '<a href="'.$_SERVER['PHP_SELF'].'">Reset Search</a>'; }} echo '<br> <br> <center>'.PHP_EOL; echo '<form action="search.php?&pages=10&q='.$keyword.'&method="get">'.PHP_EOL. '<input type="text" name="input-text" size="60%"/>'.PHP_EOL. '<input type="submit" name="data" value="Web Search"/>'.PHP_EOL.'</form>'.PHP_EOL; echo '</center> <pre> <br>'; if (isset($_GET["data"])){ ini_set("max_execution_time", 0); set_time_limit(0); // no time-outs! if(isset($_GET['q'])) $query=$_GET['q']; else $query=$keyword; if(isset($_GET['pages'])) $npages=$_GET['pages']; else $npages=10; if(isset($_GET['start'])) $start=$_GET['start']; else $start=0; if($npages>=100) $npages=100; $gg_url='http://www.google.com/search?hl=en&safe=off&filter=0&q='.urlencode($query).'&start='; $i=1; $size=0; $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects CURLOPT_COOKIEFILE => "cookie.txt", CURLOPT_COOKIEJAR => "cookie.txt", CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0", CURLOPT_REFERER => "http://www.google.com/"); for ($page = $start; $page < $npages; $page++){ $ch = curl_init($gg_url.$page.'0'); curl_setopt_array($ch,$options); $scraped=""; $scraped.=curl_exec($ch); curl_close($ch); $results = array(); preg_match_all('/a href="([^"]+)" class=l.+?>.+?<\/a>/',$scraped,$results); foreach ($results[1] as $url){ echo " <a href='$url'>$url</a>".PHP_EOL; $i++; } $size+=strlen($scraped); } @fclose($fp); $Num=$i-1; echo "<br><br>Number of results: ".$Num.PHP_EOL; echo "Total KB read: ".($size/1024.0).PHP_EOL; } ?>

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).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0150.00016.75
8.3.50.0140.00917.54
8.3.40.0110.00419.21
8.3.30.0040.01118.93
8.3.20.0050.00318.98
8.3.10.0050.00319.04
8.3.00.0100.00017.88
8.2.180.0100.00618.55
8.2.170.0070.00722.96
8.2.160.0080.00519.49
8.2.150.0050.00224.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00820.61
8.2.110.0030.00621.12
8.2.100.0120.00019.88
8.2.90.0040.00418.41
8.2.80.0080.00018.05
8.2.70.0080.00018.29
8.2.60.0030.00618.27
8.2.50.0000.00918.10
8.2.40.0060.00319.59
8.2.30.0000.00819.48
8.2.20.0080.00017.95
8.2.10.0040.00418.10
8.2.00.0000.01018.04
8.1.280.0060.01225.92
8.1.270.0050.00324.66
8.1.260.0030.00526.35
8.1.250.0070.00028.09
8.1.240.0040.00423.96
8.1.230.0080.00422.69
8.1.220.0040.00417.79
8.1.210.0080.00019.16
8.1.200.0000.01117.38
8.1.190.0040.00717.41
8.1.180.0030.00618.10
8.1.170.0040.00418.80
8.1.160.0040.00419.04
8.1.150.0000.00719.00
8.1.140.0030.00617.69
8.1.130.0030.00317.98
8.1.120.0040.00417.72
8.1.110.0050.00317.57
8.1.100.0000.00717.73
8.1.90.0020.00517.70
8.1.80.0000.00717.72
8.1.70.0000.00817.68
8.1.60.0030.00617.80
8.1.50.0000.00817.62
8.1.40.0040.00417.73
8.1.30.0000.00717.71
8.1.20.0040.00417.88
8.1.10.0040.00417.85
8.1.00.0000.00917.70
8.0.300.0000.00819.87
8.0.290.0040.00417.00
8.0.280.0030.00318.48
8.0.270.0000.00717.23
8.0.260.0030.00317.03
8.0.250.0000.00817.28
8.0.240.0050.00317.16
8.0.230.0070.00017.14
8.0.220.0070.00017.16
8.0.210.0140.00017.08
8.0.200.0030.00317.28
8.0.190.0030.00517.13
8.0.180.0030.00517.11
8.0.170.0090.00017.09
8.0.160.0070.00017.08
8.0.150.0000.01017.01
8.0.140.0020.00717.12
8.0.130.0030.00313.61
8.0.120.0000.00717.04
8.0.110.0040.00417.17
8.0.100.0040.00416.97
8.0.90.0000.00817.28
8.0.80.0060.00917.14
8.0.70.0030.00517.05
8.0.60.0040.00417.21
8.0.50.0070.00017.17
8.0.30.0130.00617.41
8.0.20.0100.00817.42
8.0.10.0000.00717.25
8.0.00.0120.00617.04
7.4.330.0000.00713.12
7.4.320.0000.00616.81
7.4.300.0070.00016.87
7.4.290.0060.00316.91
7.4.280.0040.00416.71
7.4.270.0000.00816.80
7.4.260.0050.00013.57
7.4.250.0050.00316.90
7.4.240.0000.00816.80
7.4.230.0000.00716.80
7.4.220.0090.01316.78
7.4.210.0090.00816.89
7.4.200.0000.00716.90
7.4.190.0040.00417.04
7.4.160.0120.00316.88
7.4.150.0070.01016.90
7.4.140.0090.01216.83
7.4.130.0140.00516.83
7.4.120.0100.01016.76
7.4.110.0140.00316.73
7.4.100.0130.00416.94
7.4.90.0150.00616.94
7.4.80.0150.00719.39
7.4.70.0070.01016.71
7.4.60.0080.00816.79
7.4.50.0060.00616.81
7.4.40.0060.00916.77
7.4.30.0130.00316.89
7.4.10.0090.00915.19
7.4.00.0060.01015.37
7.3.330.0000.00713.51
7.3.320.0000.00513.57
7.3.310.0030.00616.48
7.3.300.0070.00016.57
7.3.290.0070.00716.67
7.3.280.0080.01316.63
7.3.270.0140.01116.73
7.3.260.0150.00316.74
7.3.250.0110.01016.60
7.3.240.0170.00016.68
7.3.230.0120.00616.66
7.3.210.0080.01116.71
7.3.200.0110.00616.70
7.3.190.0050.01416.53
7.3.180.0100.00716.73
7.3.170.0100.01016.79
7.3.160.0090.00816.69
7.3.130.0130.00515.12
7.3.120.0090.00915.18
7.3.110.0080.01115.10
7.3.100.0070.01015.18
7.3.90.0070.00815.11
7.3.80.0050.00915.11
7.3.70.0100.00515.11
7.3.60.0110.00415.09
7.3.50.0040.00815.10
7.3.40.0060.00615.07
7.3.30.0040.00915.08
7.3.20.0050.01116.74
7.3.10.0090.00416.79
7.3.00.0070.00716.82
7.2.330.0060.01917.02
7.2.320.0060.01316.88
7.2.310.0070.01816.72
7.2.300.0070.01816.99
7.2.290.0130.00316.93
7.2.260.0080.00715.38
7.2.250.0100.00615.25
7.2.240.0050.01115.31
7.2.230.0060.01015.23
7.2.220.0070.00815.33
7.2.210.0100.00615.31
7.2.200.0100.00615.30
7.2.190.0010.01215.32
7.2.180.0020.01115.28
7.2.170.0040.00815.36
7.2.160.0080.00615.31
7.2.150.0060.01017.10
7.2.140.0060.00617.11
7.2.130.0080.00717.25
7.2.120.0080.00816.95
7.2.110.0050.00916.89
7.2.100.0080.00617.18
7.2.90.0100.00517.29
7.2.80.0020.01317.08
7.2.70.0060.00817.13
7.2.60.0050.00716.93
7.2.50.0050.01217.06
7.2.40.0100.00417.04
7.2.30.0070.00917.11
7.2.20.0070.00817.00
7.2.10.0050.00917.17
7.2.00.0050.00917.75
7.1.330.0060.00815.99
7.1.320.0040.00915.78
7.1.310.0060.00616.09
7.1.300.0010.01115.94
7.1.290.0050.00815.87
7.1.280.0030.01115.94
7.1.270.0090.00616.03
7.1.260.0040.01115.92
7.1.250.0020.01115.93
7.1.240.0060.00716.02
7.1.230.0030.00916.00
7.1.220.0020.01116.00
7.1.210.0030.00915.97
7.1.200.0030.01115.99
7.1.190.0050.00916.02
7.1.180.0080.00815.94
7.1.170.0060.00915.92
7.1.160.0110.00415.91
7.1.150.0060.00815.70
7.1.140.0040.01016.06
7.1.130.0080.00415.93
7.1.120.0060.00815.99
7.1.110.0060.00816.03
7.1.100.0060.00516.55
7.1.90.0040.01115.96
7.1.80.0070.00416.05
7.1.70.0020.00916.35
7.1.60.0070.00816.82
7.1.50.0110.00720.62
7.1.40.0100.00415.97
7.1.30.0080.00515.87
7.1.20.0040.00815.89
7.1.10.0090.00515.94
7.1.00.0080.02117.58
7.0.330.0040.00815.39
7.0.320.0050.00915.34
7.0.310.0040.00915.62
7.0.300.0080.00415.40
7.0.290.0050.00815.48
7.0.280.0080.00515.57
7.0.270.0070.00615.42
7.0.260.0070.00515.67
7.0.250.0070.00615.67
7.0.240.0050.00815.62
7.0.230.0060.00615.54
7.0.220.0060.00715.44
7.0.210.0040.00615.38
7.0.200.0120.00815.51
7.0.190.0030.00915.31
7.0.180.0050.00715.63
7.0.170.0030.00815.32
7.0.160.0050.00515.56
7.0.150.0020.01215.42
7.0.140.0050.02317.31
7.0.130.0050.00915.59
7.0.120.0030.01517.16
7.0.110.0060.00515.59
7.0.100.0060.00615.70
7.0.90.0060.00415.58
7.0.80.0070.00615.60
7.0.70.0050.00615.69
7.0.60.0050.01517.08
7.0.50.0040.02816.19
7.0.40.0050.01615.12
7.0.30.0090.01615.19
7.0.20.0080.02115.27
7.0.10.0050.02815.24
7.0.00.0100.02215.34
5.6.400.0070.00814.65
5.6.390.0100.00514.56
5.6.380.0090.00614.43
5.6.370.0060.00614.33
5.6.360.0030.00914.58
5.6.350.0070.00714.50
5.6.340.0090.00714.55
5.6.330.0020.01014.61
5.6.320.0020.01114.57
5.6.310.0040.00914.57
5.6.300.0050.00714.56
5.6.290.0050.00414.57
5.6.280.0050.02216.10
5.6.270.0040.00814.59
5.6.260.0020.00914.61
5.6.250.0010.01214.65
5.6.240.0060.00814.48
5.6.230.0040.00914.50
5.6.220.0040.00914.66
5.6.210.0070.01916.08
5.6.200.0050.01815.53
5.6.190.0060.02015.97
5.6.180.0100.01616.04
5.6.170.0120.01815.99
5.6.160.0060.02516.13
5.6.150.0030.01715.44
5.6.140.0040.01415.58
5.6.130.0070.02315.61
5.6.120.0050.01816.17
5.6.110.0080.01916.14
5.6.100.0070.02016.16
5.6.90.0050.01616.17
5.6.80.0090.02215.81
5.6.70.0010.01114.41
5.6.60.0060.00814.44
5.6.50.0060.00614.53
5.6.40.0060.00714.37
5.6.30.0050.00814.42
5.6.20.0070.00814.46
5.6.10.0020.01014.50
5.6.00.0050.00714.42
5.5.380.0060.00614.67
5.5.370.0060.00714.48
5.5.360.0070.00414.20
5.5.350.0070.02915.86
5.5.340.0080.02215.48
5.5.330.0050.02616.01
5.5.320.0080.01915.89
5.5.310.0120.01415.96
5.5.300.0030.01515.24
5.5.290.0060.02515.32
5.5.280.0030.02016.01
5.5.270.0040.02416.10
5.5.260.0050.01716.04
5.5.250.0080.02215.97
5.5.240.0080.02115.97
5.5.230.0030.01214.32
5.5.220.0070.00814.43
5.5.210.0070.00614.21
5.5.200.0080.00714.48
5.5.190.0030.01114.45
5.5.180.0060.00614.45
5.5.170.0070.00714.40
5.5.160.0090.00314.42
5.5.150.0080.00514.23
5.5.140.0030.01014.34
5.5.130.0110.00414.42
5.5.120.0050.01014.30
5.5.110.0060.00714.29
5.5.100.0050.00714.39
5.5.90.0040.01014.40
5.5.80.0030.00914.29
5.5.70.0040.00614.46
5.5.60.0060.00714.25
5.5.50.0050.00814.44
5.5.40.0060.00814.36
5.5.30.0070.00714.29
5.5.20.0030.01114.56
5.5.10.0080.00614.21
5.5.00.0020.01314.18
5.4.450.0050.02413.58
5.4.440.0090.02013.49
5.4.430.0030.02513.56
5.4.420.0020.02513.58
5.4.410.0060.01113.60
5.4.400.0040.01713.46
5.4.390.0020.01613.48
5.4.380.0040.01413.46
5.4.370.0050.02213.49
5.4.360.0050.01913.42
5.4.350.0050.01613.46
5.4.340.0030.02413.47
5.4.330.0040.00511.58
5.4.320.0030.02713.44
5.4.310.0060.01813.43
5.4.300.0050.01513.40
5.4.290.0040.01813.42
5.4.280.0030.01813.34
5.4.270.0040.02013.41
5.4.260.0070.01613.38
5.4.250.0030.02213.50
5.4.240.0020.01813.47
5.4.230.0040.01613.43
5.4.220.0050.02413.45
5.4.210.0050.01813.44
5.4.200.0060.02113.45
5.4.190.0030.02013.39
5.4.180.0020.01713.42
5.4.170.0050.01713.37
5.4.160.0070.01213.46
5.4.150.0090.01513.44
5.4.140.0070.01812.79
5.4.130.0030.01612.85
5.4.120.0050.02112.82
5.4.110.0060.01712.78
5.4.100.0060.01812.77
5.4.90.0040.02512.67
5.4.80.0050.02012.82
5.4.70.0050.01412.76
5.4.60.0070.02012.76
5.4.50.0050.02112.70
5.4.40.0040.01412.76
5.4.30.0070.01812.77
5.4.20.0020.02512.86
5.4.10.0070.02212.73
5.4.00.0030.01812.67
5.3.290.0030.06714.63
5.3.280.0100.03714.56
5.3.270.0030.04014.64
5.3.260.0100.07014.61
5.3.250.0100.04314.65
5.3.240.0100.05314.56
5.3.230.0000.07714.59
5.3.220.0070.04714.54
5.3.210.0100.07314.57
5.3.200.0070.07714.49
5.3.190.0100.07014.52
5.3.180.0200.06014.68
5.3.170.0100.05314.56
5.3.160.0100.04314.55
5.3.150.0000.05314.56
5.3.140.0000.05014.56
5.3.130.0100.07014.50
5.3.120.0130.04314.39
5.3.110.0070.08014.52
5.3.100.0030.05013.86
5.3.90.0100.03714.15
5.3.80.0070.03713.98
5.3.70.0030.03713.97
5.3.60.0100.06313.96
5.3.50.0100.06313.91
5.3.40.0070.07313.95
5.3.30.0070.06713.86
5.3.20.0130.06013.64
5.3.10.0000.04713.62
5.3.00.0070.06013.59
5.2.170.0000.03311.11
5.2.160.0070.03011.18
5.2.150.0070.06011.03
5.2.140.0070.06011.15
5.2.130.0070.03311.07
5.2.120.0100.06010.96
5.2.110.0030.04711.13
5.2.100.0030.03711.04
5.2.90.0070.05711.07
5.2.80.0030.03010.95
5.2.70.0030.03711.00
5.2.60.0000.03311.02
5.2.50.0000.07010.94
5.2.40.0030.05711.02
5.2.30.0130.05710.98
5.2.20.0000.05010.89
5.2.10.0100.05310.89
5.2.00.0100.05310.82
5.1.60.0000.0609.88
5.1.50.0000.02710.04
5.1.40.0030.05710.00
5.1.30.0000.04710.44
5.1.20.0100.04310.38
5.1.10.0070.04310.07
5.1.00.0170.04710.00
5.0.50.0030.0479.36
5.0.40.0070.0439.36
5.0.30.0100.0479.36
5.0.20.0070.0409.36
5.0.10.0030.0309.36
5.0.00.0100.0609.36
4.4.90.0030.0139.36
4.4.80.0000.0179.36
4.4.70.0000.0379.36
4.4.60.0070.0239.36
4.4.50.0070.0239.36
4.4.40.0000.0279.36
4.4.30.0000.0209.36
4.4.20.0030.0339.36
4.4.10.0030.0279.36
4.4.00.0000.0309.36
4.3.110.0030.0179.36
4.3.100.0000.0309.36
4.3.90.0030.0339.36
4.3.80.0030.0479.36
4.3.70.0030.0279.36
4.3.60.0030.0339.36
4.3.50.0000.0339.36
4.3.40.0030.0509.36
4.3.30.0070.0179.36
4.3.20.0000.0409.36
4.3.10.0100.0279.36
4.3.00.0030.0239.36

preferences:
55.02 ms | 401 KiB | 5 Q