-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtwitter.php
22 lines (17 loc) · 827 Bytes
/
twitter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?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);
?>