PHP code example of benhall14 / php-twitter-widget
1. Go to this page and download the library: Download benhall14/php-twitter-widget library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
benhall14 / php-twitter-widget example snippets
try {
$twitterWidget = new TwitterWidget(
$consumer_key, # your Twitter consumer key
$consumer_secret, # your Twitter consumer secret
$access_token, # your Twitter access token
$access_token_secret, # your Twitter access token secret
'nasa', # the screen name of the Twitter feed to display
15, # the number of tweets to return
'../cache/twitter_status_feed.json', # path to the cache file
3600 # the number of seconds to cache the feed for, default is 3600 (1 hour)
);
} catch (Exception $e) {
/* handle any error thrown, such as unwritable cache file */
echo $e->getMessage();
}
echo $twitterWidget->display('My Tweets', true, 'M d H:i A');