Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function req($url, $token = null, $data = null, $pin = null){
- $header[] = "Host: api.gojekapi.com";
- $header[] = "User-Agent: okhttp/3.12.1";
- $header[] = "Accept: application/json";
- $header[] = "Accept-Language: en-ID";
- $header[] = "Content-Type: application/json; charset=UTF-8";
- $header[] = "X-AppVersion: 3.34.1";
- $header[] = "X-UniqueId: ".time()."57".mt_rand(1000,9999);
- $header[] = "Connection: keep-alive";
- $header[] = "X-User-Locale: en_ID";
- //$header[] = "X-Location: -6.3894201,106.0794195";
- //$header[] = "X-Location-Accuracy: 3.0";
- if ($pin):
- $header[] = "pin: $pin";
- endif;
- if ($token):
- $header[] = "Authorization: Bearer $token";
- endif;
- $c = curl_init("https://api.gojekapi.com".$url);
- curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
- if ($data):
- curl_setopt($c, CURLOPT_POSTFIELDS, $data);
- curl_setopt($c, CURLOPT_POST, true);
- endif;
- curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($c, CURLOPT_HEADER, true);
- curl_setopt($c, CURLOPT_HTTPHEADER, $header);
- $response = curl_exec($c);
- $httpcode = curl_getinfo($c);
- if (!$httpcode)
- return false;
- else {
- $header = substr($response, 0, curl_getinfo($c, CURLINFO_HEADER_SIZE));
- $body = substr($response, curl_getinfo($c, CURLINFO_HEADER_SIZE));
- }
- $json = json_decode($body, true);
- return $json;
- }
- function save($filename, $content)
- {
- $save = fopen($filename, "a");
- fputs($save, "$content\r\n");
- fclose($save);
- }
- function cek($token)
- {
- $claim = req("/gopoints/v3/wallet/vouchers?limit=10&page=1", $token, null);
- if ($claim['success'] == 1)
- {
- return $claim;
- }
- else
- {
- save("error_log.txt", json_encode($claim));
- return false;
- }
- }
- echo 'Enter Token : ';
- $otp = trim(fgets(STDIN));
- $iki = cek($otp);
- foreach ($iki['data'] as $items) {
- echo $items['title'].PHP_EOL;
- echo $items['expiry_date'].PHP_EOL;
- echo $items['configs'][0]['key'].' '.$items['configs'][0]['value'].PHP_EOL;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement