-
-
Save brendonexus/d79f42ee3f3bbe0eb5ec8c0e03dab16a 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 | |
require '_config.php'; | |
$twitteruser = 'webfwd'; | |
$tweetexpire = 60 * 30; // Seconds | |
$tweetfile = DOCROOT.'/twitter.txt'; | |
use Abraham\TwitterOAuth\TwitterOAuth; | |
if (!file_exists($tweetfile) || (time()-filemtime($tweetfile)) > $tweetexpire) { | |
$connection = new TwitterOAuth( | |
"", // API Key | |
"", // API Secret | |
"", // Access Token | |
"" // Access Token Secret | |
); | |
$content = $connection->get("account/verify_credentials"); | |
$statuses = $connection->get('statuses/user_timeline', array('screen_name' => $twitteruser, 'exclude_replies' => 'true', 'include_rts' => 'false', 'count' => 1)); | |
$tweet = $statuses[0]->text; | |
file_put_contents($tweetfile, $tweet); | |
} else $tweet = file_get_contents($tweetfile); | |
echo $tweet; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment