Skip to content

Instantly share code, notes, and snippets.

@mojodna

mojodna/gist:38184

Last active Aug 29, 2015
Embed
What would you like to do?
#!/usr/bin/php -q
<?php
/**
* Cron job to update the comics plan.
*/
/* includes */
$_base = dirname(__FILE__) . '/../';
require_once($_base . 'config.php');
require_once($_base . 'lib/Planworld.php');
require_once($_base . 'lib/User.php');
/* create a user object for the menu user */
$_user = User::factory('comics');
$content = '';
$content .= "<p><strong>Doonesbury</strong><br /><img src=\"" . trim(`curl -s http://doonesbury.washingtonpost.com/ | grep -m 1 assets.amuniversal.com | perl -pe 's/.+content=\"(.+)\".*/$1/'`) . "\" /></p>\n";
$content .= "<p><img src=\"" . trim(`curl -s http://www.gocomics.com/nonsequitur/ | grep -m 1 assets.amuniversal.com | perl -pe 's/.+content=\"(.+)\".*/$1/'`) . "\" /></p>\n";
$content .= "<p><strong>Dilbert</strong><br />" . str_replace("img src=\"","img src=\"http://www.dilbert.com/",trim(`curl -s http://dilbert.com/ | grep -m 1 href=\"/strips/comic | perl -pe 's/.+SRC=\"(.+)\" BORDER.*/$1/'`)) . "</p>\n";
$content .= "<p><img src=\"" . trim(`curl -s http://www.gocomics.com/pearlsbeforeswine | grep -m 1 assets.amuniversal.com | perl -pe 's/.+content=\"(.+)\".*/$1/'`) . "\" /></p>\n";
$content .= "<p><strong>Rhymes with Orange</strong><br /><img src=\"" . trim(`curl -s http://rhymeswithorange.com/ | grep -m 1 content.php | perl -pe 's/.+src=\"(.+)\".*/$1/'`) . "\" /></p>\n";
$content .= "<p><img src=\"http://fborfw.com" . trim(`curl -s http://fborfw.com/strip_fix/ | grep -m 1 strips | perl -pe 's/.+src=\"(.+)\".*/$1/'`) . "\" /></p>\n";
$content .= "<p><img src=\"" . trim(`curl -s http://www.gocomics.com/monty | grep -m 1 assets.amuniversal.com | perl -pe 's/.+content=\"(.+)\".*/$1/'`) . "\" /></p>\n";
$content .= "<p><strong>Zits</strong><br /><img src=\"" . trim(`curl -s http://zitscomics.com/ | grep -m 1 content.php | perl -pe 's/.+src=\"(.+)\".*/$1/'`) . "\" /></p>\n";
$phd = trim(`curl -sH "User-Agent: Mozilla/5.0 (iPad; CPU OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) CriOS/30.0.1599.12 Mobile/11A465 Safari/8536.25 (3B92C18B-D9DE-4CB7-A02A-22FD2AF17C8F)" http://phdcomics.com/comics.php | grep -m 1 archive | perl -pe 's/.+content=\"(.+)\".*/$1/'`);
$content .= "<p><strong>PhD Comics</strong><br /><img src=\"${phd}\" /></p>\n";
$xkcd_url = exec("curl -s http://xkcd.com/ | grep -m 1 comics");
$content .= "<p><strong>xkcd</strong><br />${xkcd_url}</p>\n";
$content .= "<p>Source for this plan: <a href=\"http://gist.github.com/38184\">gist.github.com/38184</a></p>\n";
$_user->setLastLogin(mktime());
$_user->setPlan($content);
$_user->setLastUpdate(mktime());
$_user->save();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.