forked from abuusamah/gofood
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun1.php
160 lines (158 loc) · 3.56 KB
/
run1.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
<?php
include ("function.php");
function nama()
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://ninjaname.horseridersupply.com/indonesian_name.php");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$ex = curl_exec($ch);
// $rand = json_decode($rnd_get, true);
preg_match_all('~(• (.*?)<br/>• )~', $ex, $name);
return $name[2][mt_rand(0, 14) ];
}
function register($no)
{
$nama = nama();
$email = str_replace(" ", "", $nama) . mt_rand(100, 999);
$data = '{"name":"' . nama() . '","email":"' . $email . '@gmail.com","phone":"+' . $no . '","signed_up_country":"ID"}';
$register = request("/v5/customers", "", $data);
//print_r($register);
if ($register['success'] == 1)
{
return $register['data']['otp_token'];
}
else
{
return false;
}
}
function verif($otp, $token)
{
$data = '{"client_name":"gojek:cons:android","data":{"otp":"' . $otp . '","otp_token":"' . $token . '"},"client_secret":"83415d06-ec4e-11e6-a41b-6c40088ab51e"}';
$verif = request("/v5/customers/phone/verify", "", $data);
if ($verif['success'] == 1)
{
return $verif['data']['access_token'];
}
else
{
return false;
}
}
function login($no)
{
$nama = nama();
$email = str_replace(" ", "", $nama) . mt_rand(100, 999);
$data = '{"phone":"+'.$no.'"}';
$register = request("/v4/customers/login_with_phone", "", $data);
print_r($register);
if ($register['success'] == 1)
{
return $register['data']['login_token'];
}
else
{
return false;
}
}
function veriflogin($otp, $token)
{
$data = '{"client_name":"gojek:cons:android","client_secret":"83415d06-ec4e-11e6-a41b-6c40088ab51e","data":{"otp":"'.$otp.'","otp_token":"'.$token.'"},"grant_type":"otp","scopes":"gojek:customer:transaction gojek:customer:readonly"}';
$verif = request("/v4/customers/login/verify", "", $data);
if ($verif['success'] == 1)
{
return $verif['data']['access_token'];
}
else
{
return false;
}
}
function claim($token)
{
$data = '{"promo_code":"PESANGOFOOD0906"}';
$claim = request("/go-promotions/v1/promotions/enrollments", $token, $data);
if ($claim['success'] == 1)
{
return $claim['data']['message'];
}
else
{
return false;
}
}
echo "Choose Login? Login = 1 : ";
$type = trim(fgets(STDIN));
if($type == 2){
echo "It's Register Way\n";
echo "Input 62\n";
echo "Enter Number: ";
$nope = trim(fgets(STDIN));
$register = register($nope);
if ($register == false)
{
echo "Failed to Get OTP, Use Unregistered Number!\n";
}
else
{
echo "Enter Your OTP: ";
// echo "Enter Number: ";
$otp = trim(fgets(STDIN));
$verif = verif($otp, $register);
if ($verif == false)
{
echo "Failed to Registering Your Number!\n";
}
else
{
echo "Ready to Claim\n";
$claim = claim($verif);
if ($claim == false)
{
echo "Failed to Claim Voucher, Try to Claim Manually\n";
}
else
{
echo $claim . "\n";
}
}
}
}else if($type == 1){
echo "It's Login Way\n";
echo "Input 62 \n";
echo "Enter Number: ";
$nope = trim(fgets(STDIN));
$login = login($nope);
if ($login == false)
{
echo "Failed to Get OTP!\n";
}
else
{
echo "Enter Your OTP: ";
// echo "Enter Number: ";
$otp = trim(fgets(STDIN));
$verif = veriflogin($otp, $login);
if ($verif == false)
{
echo "Failed to Login with Your Number!\n";
}
else
{
echo "Ready to Claim\n";
$claim = claim($verif);
if ($claim == false)
{
echo "Failed to Claim Voucher, Try to Claim Manually\n";
}
else
{
echo $claim . "\n";
}
}
}
}
?>