Skip to content

Instantly share code, notes, and snippets.

@michalsen
Last active August 25, 2022 13:09
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 michalsen/7013754d4836c1330ce42f75ef2d2085 to your computer and use it in GitHub Desktop.
Save michalsen/7013754d4836c1330ce42f75ef2d2085 to your computer and use it in GitHub Desktop.
<?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('emichalsen@straightnorth.com', 'SN rebuild complete', 'SN Rebuild Complete');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment