-
Notifications
You must be signed in to change notification settings - Fork 134
/
tests.php
191 lines (162 loc) · 6.25 KB
/
tests.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?php
require_once('bitly.php');
$client_id = '2f4b1eb5beb9b615ac70b16e34daf4bc6b899112';
$client_secret = '149e58cfb3f5d508386822be40afc8ce75ca1c26';
$user_access_token = 'c041ec00cdfa5cefe8bda46afaa996bb038527a4';
$user_login = 'falicon';
$user_api_key = ''; <-- you can obtain this for testing your app
via the bit.ly API dashboard ( https://bitly.com/a/oauth_apps );
confirm your password and click 'generate token'...then copy/paste here
$params = array();
$params['access_token'] = $user_access_token;
$params['longUrl'] = 'http://knowabout.it';
$params['domain'] = 'j.mp';
$results = bitly_get('shorten', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$params['hash'] = 'dYhyia';
$results = bitly_get('expand', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$params['hash'] = array('dYhyia','dYhyia','abc123');
$results = bitly_get('expand', $params, true);
var_dump($results);
$params = array();
$params['hash'] = 'dYhyia';
$params['login'] = 'falicon';
$params['apiKey'] = 'R_685583af62c827761fd45d693fb3d617';
$results = bitly_get('clicks', $params);
var_dump($results);
$params = array();
$params['hash'] = 'dYhyia';
$params['login'] = 'falicon';
$params['apiKey'] = 'R_685583af62c827761fd45d693fb3d617';
$results = bitly_get('referrers', $params);
var_dump($results);
$params = array();
$params['hash'] = 'dYhyia';
$params['login'] = 'falicon';
$params['apiKey'] = 'R_685583af62c827761fd45d693fb3d617';
$results = bitly_get('countries', $params);
var_dump($results);
$params = array();
$params['hash'] = 'dYhyia';
$params['login'] = 'falicon';
$params['apiKey'] = 'R_685583af62c827761fd45d693fb3d617';
$results = bitly_get('clicks_by_minute', $params);
var_dump($results);
$params = array();
$params['domain'] = 'nyti.ms';
$params['login'] = 'falicon';
$params['apiKey'] = 'R_685583af62c827761fd45d693fb3d617';
$results = bitly_get('bitly_pro_domain', $params);
var_dump($results);
$params = array();
$params['hash'] = 'dYhyia';
$params['login'] = 'falicon';
$params['apiKey'] = 'R_685583af62c827761fd45d693fb3d617';
$results = bitly_get('info', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$results = bitly_get('user/clicks', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$results = bitly_get('user/referrers', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$params['link'] = 'http://bit.ly/dYhyia';
$results = bitly_get('link/info', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$params['url'] = 'http://knowabout.it';
$results = bitly_get('link/lookup', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$params['link'] = 'http://bit.ly/dYhyia';
$results = bitly_get('link/clicks', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$params['link'] = 'http://bit.ly/dYhyia';
$results = bitly_get('link/countries', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$params['link'] = 'http://bit.ly/dYhyia';
$results = bitly_get('link/encoders', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$params['link'] = 'http://bit.ly/dYhyia';
$results = bitly_get('link/encoders_by_count', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$params['link'] = 'http://bit.ly/dYhyia';
$results = bitly_get('link/encoders_count', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$params['link'] = 'http://bit.ly/dYhyia';
$results = bitly_get('link/referrers', $params);
$params = array();
$params['access_token'] = $user_access_token;
$params['link'] = 'http://bit.ly/dYhyia';
$results = bitly_get('link/referrers_by_domain', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$params['link'] = 'http://bit.ly/dYhyia';
$results = bitly_get('link/referring_domains', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$params['edit'] = 'title';
$params['title'] = 'tech news to know about';
$params['link'] = 'http://bit.ly/1HNOqk6';
$results = bitly_get('user/link_edit', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$params['url'] = 'http://knowabout.it';
$results = bitly_get('user/link_lookup', $params);
var_dump($results);
$params = array();
$params['access_token'] = $user_access_token;
$params['longUrl'] = 'http://knowabout.it';
$results = bitly_get('user/link_save', $params);
var_dump($results);
// TODO: finish testing for the following endpoints
//$results = bitly_get('user/save_custom_domain_keyword', $params);
//$results = bitly_get('user/info', $params);
//$results = bitly_get('user/link_history', $params);
//$results = bitly_get('user/network_history', $params);
//$results = bitly_get('user/tracking_domain_list', $params);
//$results = bitly_get('user/clicks', $params);
//$results = bitly_get('user/countries', $params);
//$results = bitly_get('user/popular_earned_by_clicks', $params);
//$results = bitly_get('user/popular_earned_by_shortens', $params);
//$results = bitly_get('user/popular_links', $params);
//$results = bitly_get('user/popular_owned_by_clicks', $params);
//$results = bitly_get('user/popular_owned_by_shortens', $params);
//$results = bitly_get('user/referrers', $params);
//$results = bitly_get('user/referring_domains', $params);
//$results = bitly_get('user/shorten_counts', $params);
//$results = bitly_get('user/tracking_domain_clicks', $params);
//$results = bitly_get('user/tracking_domain_shorten_counts', $params);
//$results = bitly_get('oauth/app', $params);
//$results = bitly_get('organization/brand_messages', $params);
//$results = bitly_get('organization/clicks', $params);
//$results = bitly_get('organization/intersecting_links', $params);
//$results = bitly_get('organization/leaderboard', $params);
//$results = bitly_get('organization/missed_opportunities', $params);
//$results = bitly_get('organization/popular_links', $params);
//$results = bitly_get('organization/shorten_counts', $params);
?>