Skip to content

Instantly share code, notes, and snippets.

@yoya
Created August 14, 2024 08:41
Show Gist options
  • Save yoya/9cb47ad0eeecae63923095e914881d52 to your computer and use it in GitHub Desktop.
Save yoya/9cb47ad0eeecae63923095e914881d52 to your computer and use it in GitHub Desktop.
HTTP Site Check
<?php
/*
* Example: php httpsitecheck.php http://www.playonline.com/ff11/campaign/wcb/data/conf.xml campaign_ $HOME/cron/ff11.xml
*/
$argc = count($argv);
if ($argc != 4) {
echo "Usage: php httpsitecheck.php <url> <keyword> <file>\n";
exit (1);
}
list($progname, $url, $keyword, $file) = $argv;
`curl -s --insecure $url > $file.next`;
if (is_file($file)) {
$diff = `diff $file $file.next | grep $keyword`;
} else {
$diff = `grep $keyword $file.next`;
}
if ($diff) {
echo $diff;
}
rename("$file.next", $file);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment