Skip to content

Instantly share code, notes, and snippets.

@TristanWiley
Created October 17, 2015 04:56
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 TristanWiley/9fc7fcff070e71df13e7 to your computer and use it in GitHub Desktop.
Save TristanWiley/9fc7fcff070e71df13e7 to your computer and use it in GitHub Desktop.
<?php
$last = file_get_contents("http://www.tristanwiley.com/latest.txt");
$url = "http://xkcd.com/info.0.json";
$json = file_get_contents($url, true);
$json_a = json_decode($json, true);
$newLatest = $json_a["num"];
if ($last != $newLatest) {
file_put_contents("therewasanewcomic.txt", time());
} else {
file_put_contents("latest.txt", $newLatest);
}
file_put_contents("latest.txt", $newLatest);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment