forked from Jamesrobert27/PonziPedia-V1.5
-
Notifications
You must be signed in to change notification settings - Fork 1
/
api.php
133 lines (126 loc) · 5.94 KB
/
api.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
<?php require_once 'app/init.php';
// +------------------------------------------------------------------------+
// | @author Olakunlevpn (Olakunlevpn)
// | @author_url 1: http://www.maylancer.cf
// | @author_url 2: https://codecanyon.net/user/gr0wthminds
// | @author_email: olakunlevpn@live.com
// +------------------------------------------------------------------------+
// | PonziPedia - Peer 2 Peer 50% ROI Donation System
// | Copyright (c) 2018 PonziPedia. All rights reserved.
// +------------------------------------------------------------------------+
?>
<?php echo View::make('header')->render() ?>
<section>
<div class="container">
<div class="row block">
<div class="col-lg-9">
<ul class="breadcrumb">
<li class="breadcrumb-item"><a href="./">Home</a></li>
<li class="breadcrumb-item">API </li>
</ul>
<h1>API <?php echo Config::get('app.version'); ?></h1>
<div class="setting-well">
<p>Our API allows you to retrieve informations from our website via GET request and supports the following query parameters: </p>
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Meaning</th>
<th>Values</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead>
<tbody>
<tr>
<td><b>type</b></td>
<td>Query type.</td>
<td>get_user_data, posts_data</td>
<td>This parameter specify the type of the query.</td>
<td><i class="fa fa-check"></i></td>
</tr>
<tr>
<td><b>limit</b></td>
<td>Limit of items.</td>
<td>LIMIT</td>
<td>This parameter specify the limit of items. Max:100 | Default:20</td>
<td><i class="fa fa-remove"></i></td>
</tr>
</tbody>
</table>
<br>
<div style="font-size:18px;">How to start?</div>
<hr>
<ol style="list-style: initial;">
<li>Once you have created the app, you'll get APP_ID, and APP_SECRET. <br>Example: <br><br> <img src="https://s3.postimg.org/4vaacpclf/Screenshot_24.png" alt=""><br><br></li>
<li>To start the Oauth process, use the link <?php echo Config::get('app.url'); ?>oauth?app_id={YOUR_APP_ID}<br><br></li>
<li>Once the end user clicks this link, he/she will be redirected to the authorization page.<br><br></li>
<li>Once the end user authorization the app, he/she will be redirected to your domain name with a GET parameter "code", example: http://yourdomain/?code=XXX<br><br></li>
<li>
In your code, to retrieve the authorized user info, you need to generate an access code, please use the code below:<br><br>
<ol style="list-style: initial;">
<li>
PHP:
<code>
<pre><?php
$app_id = 'YOUR_APP_ID'; // your application app id
$app_secret = 'YOUR_APP_SECRET'; your application app secret
$code = $_GET['code']; // the GET parameter you got in the callback: http://yourdomain/?code=XXX
$get = file_get_contents("<?php echo Config::get('app.url'); ?>authorize?app_id={$app_id}&app_secret={$app_secret}&code={$code}");
$json = json_decode($get, true);
if (!empty($json['access_token'])) {
$access_token = $json['access_token']; // your access token
}
?></pre>
</code>
</li>
</ol>
</li>
<li>
Once you got the access code, simple call the data you would like to retrieve, Example: <br><br>
<ol style="list-style: initial;">
<li>PHP:
<code>
<pre>if (!empty($json['access_token'])) {
$access_token = $json['access_token']; // your access token
$type = "get_user_data"; // or posts_data
$get = file_get_contents("<?php echo Config::get('app.url'); ?>app_api?access_token={$access_token}&type={$type}");
}
</pre> </code>
</li>
<li>
Respond:
<pre><b>Json</b>output
{
"api_status": "success",
"api_version": "1.3",
"user_data": {
"id": "",
"username": "",
"first_name": "",
"last_name": "",
"gender": "",
"birthday": "",
"about": "",
"website": "",
"facebook": "",
"twitter": "",
"vk": "",
"google+": "",
"profile_picture": "",
"cover_picture": "",
"verified": "",
"url": ""
}
}
</pre>
</li>
</ol>
</li>
</ol>
</div>
</div>
</div>
</div>
</section>
<?php echo View::make('footer')->render() ?>