-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtweets.php
34 lines (26 loc) · 864 Bytes
/
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
<?php
//get config
$config=json_decode(file_get_contents('config.json'), true);
if ($config['debug']) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(-1);
}
// require twitter class
require_once 'vendor/dg/twitter-php/src/twitter.class.php';
// new twitter
$twitter = new Twitter(
$config['keys']['consumer_key'],
$config['keys']['consumer_secret'],
$config['keys']['access_token'],
$config['keys']['access_token_secret']
);
$opts=array('q'=>$config['hashtag']."+exclude:retweets",
'result_type'=>'mixed',
'include_entities'=>true,
'tweet_mode' => 'extended',
'count'=>100
);
header('Content-Type: application/json');
$tweets=$twitter->search($opts);
echo json_encode($tweets);