-
Notifications
You must be signed in to change notification settings - Fork 0
/
twitter_scan.php
124 lines (120 loc) · 3.53 KB
/
twitter_scan.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
use Abraham\TwitterOAuth\TwitterOAuth;
include('twitter_timeline_func.php');
include('twitter_list_func.php');
include("twitter_points.php");
include("twitter_update_record.php");
//include('twitter_regular_scan_func');
function scanTimeline()
{
global $user_name,$account_id,$screen_name,$connection,$conn;
//$tweet=array();
$total_likes=array();
$total_subscribed_lists=array("");
try{
$test="SELECT u_id FROM user_accounts WHERE account_id='$account_id' AND at_id=2";
$result=mysqli_query($conn,$test);
if(mysqli_num_rows($result)>0)
{
$res=mysqli_fetch_array($result);
$pid=$res['u_id'];
$tst="select * from scan_mx_id where u_id=$pid AND response_type=1";
$reslt=mysqli_query($conn,$tst);
$lk="select * from scan_mx_id where u_id=$pid AND response_type=3";
$lkr=mysqli_query($conn,$lk);
if(mysqli_num_rows($reslt)>0)
{
$rt=mysqli_fetch_array($reslt);
$resp=$rt['response'];
if(!empty($resp))
{
regular_scan_timeline($resp,$account_id);
}
else
{
echo "<br><br><b>screen name : ".$_SESSION['screen_name']."</b><br>";
profile_scan($account_id);
$tweet=$connection->get('statuses/user_timeline',['user_id'=>$account_id,'count'=>200,'exclude_replies'=>false]);
$_SESSION['tweet']=$tw[]=$tweet;
echo "<b>TWEETS</b><br>";
if(!empty($tweet))
{
scanTweets($tweet);
}
}
}
else
{
global $list;
$list=array();
echo "<br><br><b>screen name : ".$_SESSION['screen_name']."</b><br>";
profile_scan($account_id);
$tweet=$connection->get('statuses/user_timeline',['user_id'=>$account_id,'count'=>200,'exclude_replies'=>false]);
$_SESSION['tweet']=$tw[]=$tweet;
echo "<b>TWEETS</b><br>";
if(!empty($tweet))
{
scanTweets($tweet);
}
}
if(mysqli_num_rows($lkr)>0)
{
$lkt=mysqli_fetch_array($lkr);
$lkrsp=$lkt['response'];
regular_scanlikes($lkrsp,$account_id);
}
else{
echo "<b>other Likes</b><br>";
$tweet_likes= $connection->get('favorites/list',['user_id'=>$account_id,'count'=>20]);
$total_likes[]=$tweet_likes;
if(!empty($tweet_likes))
scanlikes($tweet_likes);
}
//scan_comments();
echo " <b>retweeters</b><br>";
retweeters();
//global $ids;
$respostr=array();
//scanlist();
//$ids=array();
}
}
catch(TwitterException $e)
{
echo "twitter returned an error".$e->getStatusCode();
}
}
function scanlist()
{
global $connection,$conn,$points_db,$screen_name,$account_id;
echo "<b>Owned Lists</b><br>";
$cursor=-1;
while($cursor!=0)
{
$ownedlist=$connection->get('lists/ownerships',['screen_name'=>$screen_name,'count'=>100,'cursor'=>$cursor]);
$_SESSION['$total_owned_lists']=$total_owned_lists[]=$ownedlist;
//print_r($total_owned_lists);
$cursor=$ownedlist->next_cursor;
scan_owned_lists();
}
echo "<b>subscribed Lists by user</b><br>";
$scursor=-1;
while($scursor!=0)
{
$subscribedlist=$connection->get('lists/subscriptions',['screen_name'=>$screen_name,'count'=>100,'cursor'=>$scursor]);
$_SESSION['$total_subscribed_lists']=$total_subscribed_lists[]=$subscribedlist;
$scursor=$subscribedlist->next_cursor;
scan_subscribed_lists();
}
echo "<b>added to</b><br>";
$acursor=-1;
while($acursor!=0)
{
$addedtolist=$connection->get('lists/memberships',['screen_name'=>$screen_name,'count'=>100,'cursor'=>$acursor]);
$_SESSION['$total_addedto_lists']=$total_addedto_lists[]=$addedtolist;
$acursor=$addedtolist->next_cursor;
scan_addedto_list();
}
//echo " sub from list.<br>";
//prospective_from_list();
}