Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (17 sloc) 827 Bytes
<?php
session_start();
require_once("twitteroauth/twitteroauth/twitteroauth.php"); //Path to twitteroauth library
$twitteruser = "twitterusername";
$notweets = 30;
$consumerkey = "TdqJEbQKk1bnB7VzVoCtJw";
$consumersecret = "4tObFBY7UWPeshn5MMpui3w7MPe9EZqKTuEfE0PAU8";
$accesstoken = "123456789";
$accesstokensecret = "12345";
function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
$connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
return $connection;
}
$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets);
echo json_encode($tweets);
?>