Created
October 17, 2015 04:56
-
-
Save TristanWiley/9fc7fcff070e71df13e7 to your computer and use it in GitHub Desktop.
This file contains 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 | |
$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