-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathget_tweets.php
executable file
·35 lines (28 loc) · 1.1 KB
/
get_tweets.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require_once('twitter_proxy.php');
// Twitter OAuth Config options
$oauth_access_token = 'your-token-here';
$oauth_access_token_secret = 'your-token-secret';
$consumer_key = 'your-api-key';
$consumer_secret = 'your-api-secret';
$user_id = '78884300';
$screen_name = 'parallax';
$count = 5;
$twitter_url = 'statuses/user_timeline.json';
$twitter_url .= '?user_id=' . $user_id;
$twitter_url .= '&screen_name=' . $screen_name;
$twitter_url .= '&count=' . $count;
// Create a Twitter Proxy object from our twitter_proxy.php class
$twitter_proxy = new TwitterProxy(
$oauth_access_token, // 'Access token' on https://apps.twitter.com
$oauth_access_token_secret, // 'Access token secret' on https://apps.twitter.com
$consumer_key, // 'API key' on https://apps.twitter.com
$consumer_secret, // 'API secret' on https://apps.twitter.com
$user_id, // User id (http://gettwitterid.com/)
$screen_name, // Twitter handle
$count // The number of tweets to pull out
);
// Invoke the get method to retrieve results via a cURL request
$tweets = $twitter_proxy->get($twitter_url);
echo $tweets;
?>