-
Notifications
You must be signed in to change notification settings - Fork 0
/
tweet_trend.php
83 lines (62 loc) · 1.89 KB
/
tweet_trend.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* Created by PhpStorm.
* User: kongu
* Date: 01-Aug-15
* Time: 1:39 PM
*/
require_once getcwd().'/twitteroauth/autoload.php';
require_once getcwd().'/phpInsight-master/autoload.php';
require_once getcwd().'/NewWorld.php';
use Abraham\TwitterOAuth\TwitterOAuth;
#use NewWorld;
try {
$sentiment = new \PHPInsight\Sentiment();
$nw = new NewWorld();
$toa = $nw->GetAPICon();
$woeid_World = 1;
$woeid_India = 23424848;
$woeid_USA = 23424977;
$query_World = array(
"id" => $woeid_World
);
$query_India = array(
"id" => $woeid_India
);
$query_USA = array(
"id" => $woeid_USA
);
$results_world = $nw->GetTrendPlace($toa,$query_World);
$results_India = $nw->GetTrendPlace($toa,$query_India);
$results_USA = $nw->GetTrendPlace($toa,$query_USA);
#echo json_encode($results_world);
#echo gettype($results_world).'<br><br>';
echo '<html><head></head><body>';
echo '<table width=100%>
<tr>
<td><a style="color:red;font-size: large"> Trending in World : </a></td>
<td> <a style="color:red;font-size: large"> Trending in India : </a></td>
<td><a style="color:red;font-size: large"> Trending in USA : </a></td>
</tr><tr><td>';
foreach ($results_world as $resultw) {
foreach($resultw->trends as $result){
echo '<br>'.rawurldecode($result->name);
}
}
echo '</td><td>';
foreach ($results_India as $resultw) {
foreach($resultw->trends as $result){
echo '<br>'.rawurldecode($result->name);
}
}
echo '</td><td>';
foreach ($results_USA as $resultw) {
foreach($resultw->trends as $result){
echo '<br>'.rawurldecode($result->name);
}
}
echo '</td></tr></table></body></html>';
}
catch(Exception $e) {
echo 'Message: ' .$e->getMessage();
}