diamondpedia

Untitled

Oct 27th, 2019
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.41 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. include 'header.php';
  4.  
  5. function curl($url, $fields = null, $headers = null)
  6.     {
  7.         $ch = curl_init();
  8.         curl_setopt($ch, CURLOPT_URL, $url);
  9.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  10.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  11.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  12.         if ($fields !== null) {
  13.             curl_setopt($ch, CURLOPT_POST, 1);
  14.             curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
  15.         }
  16.         if ($headers !== null) {
  17.             curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  18.         }
  19.         $result   = curl_exec($ch);
  20.         $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  21.         curl_close($ch);
  22.        
  23.         return array(
  24.             $result,
  25.             $httpcode
  26.         );
  27.     }
  28. {
  29. $secret = 'xxxx-xxxxxxxxx-xxxxxx'; //BEARERTOKENAKUNUTAMA
  30. $pin = "xxxxxx"; //PINGOPAY
  31. $headers = array();
  32. $header[] = 'Content-Type: application/json';
  33. $header[] = 'X-AppVersion: 3.40.0';
  34. $header[] = "X-Uniqueid: ac94e5d0e7f3f".rand(111,999);
  35. $header[] = 'X-Location: -6.405821,106.064193';
  36. $header[] ='Authorization: Bearer '.$secret;
  37. $header[] = 'pin:'.$pin.'';
  38.  
  39. $amount = "1";
  40. $amountt = $amount;
  41. $number = $_POST['phone'];
  42.         $numbers = $number[0].$number[1];
  43.         $numberx = $number[5];
  44.         if($numbers == "08") {
  45.             $number = str_replace("08","628",$number);
  46.         } elseif ($numberx == " ") {
  47.             $number = preg_replace("/[^0-9]/", "",$number);
  48.             $number = "1".$number;
  49.         }
  50. }
  51.     if(isset($_POST['submit']))
  52.     {
  53.  
  54. $getqrid = curl('https://api.gojekapi.com/wallet/qr-code?phone_number=%2B'.$number.'', null, $header);
  55.                     $jsqrid = json_decode($getqrid[0]);
  56.                     $qrid = $jsqrid->data->qr_id;
  57.                    
  58. $tf = curl('https://api.gojekapi.com/v2/fund/transfer', '{"amount":"'.$amountt.'","description":"ZAL ","qr_id":"'.$qrid.'"}', $header);
  59. $jstf = json_decode($tf[0]);
  60. $tfref = $jstf->data->transaction_ref;
  61. if ($jstf && true === $jstf->success) {
  62.                         echo '
  63.                        <div class="alert alert-success">
  64.  <strong>Success!</strong> Berhasil Transfer Gopay <b>Rp.'.$amountt.'</b> Ke <b>'.$number.'</b> . Trx ID: <b>'.$tfref.'</b>
  65. </div>
  66. ';
  67.                     } else {
  68.                         echo '
  69. <div class="alert alert-warning">
  70.  <strong>Failed!</strong> Gagal Transfer Gopay.
  71. </div>
  72. ';
  73. }
  74.  
  75. }
  76.     {
  77.  
  78. $detail = curl('https://api.gojekapi.com/wallet/profile/detailed', null, $header);
  79.                     $saldoo = json_decode($detail[0]);
  80.                     $saldo = $saldoo->data->balance;
  81.                     echo '
  82.      <button type="button" class="btn btn-default">Saldo: <b>Rp. '.$saldo.'</b></button>
  83.    
  84.      <br><br>
  85.                            <form action="" method="POST">
  86.              <div class="input-group">
  87.    <span class="input-group-addon"><i class="glyphicon glyphicon-phone"></i></span>
  88.      <input id="phone" type="text" class="form-control" name="phone" placeholder="62 or 1">
  89.      </div>
  90.      <br>
  91.          <center>    
  92.          <button type="reset" class="btn btn-default"><i class="fa fa-refresh"></i> Reset</button>
  93.          <button type="submit" name="submit" class="btn btn-info"><i class="fa fa-paper-plane-o"></i> Submit</button></center>
  94.      </div>
  95.    </div>
  96. </form>
  97. </body>
  98. </html>';
  99.     }
  100.  
  101. ?>
Advertisement
Add Comment
Please, Sign In to add comment