Last active
August 25, 2022 13:09
-
-
Save michalsen/7013754d4836c1330ce42f75ef2d2085 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Total Execution Time: 134 Min | |
$time_start = microtime(true); | |
$handle = fopen("sn_urls.inc", "r"); | |
// $handle = fopen("equipment.inc", "r"); | |
// $handle = fopen("positions.inc", "r"); | |
$positions = ['null', | |
'forwards', | |
'left-wing', | |
'right-wing', | |
'center', | |
'defenseman', | |
'goalie']; | |
if ($handle) { | |
while (($line = fgets($handle)) !== false) { | |
if (preg_match('/equipment/', $line)) { | |
foreach ($positions as $position) { | |
if ($position != 'null') { | |
visit(trim($line) . '?' . $position); | |
} | |
else { | |
visit(trim($line)); | |
} | |
} | |
} | |
else { | |
visit($line); | |
} | |
} | |
fclose($handle); | |
} else { | |
// error opening the file. | |
} | |
$time_end = microtime(true); | |
//dividing with 60 will give the execution time in minutes otherwise seconds | |
$execution_time = ($time_end - $time_start)/60; | |
//execution time of the script | |
echo "Total Execution Time: " . $execution_time. " Mins \n"; | |
function visit($url) { | |
// print "\n\n\n###\n\n\n" . $url . "\n\n\n###\n\n\n"; | |
exec('wget --spider --header="X-Bypass-Cache: 1" https://www.geargeek.com' . $url); | |
// print '.'; | |
} | |
mail('[email protected]', 'SN rebuild complete', 'SN Rebuild Complete'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment