Advertisement
Guest User

Untitled

a guest
Nov 4th, 2018
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.50 KB | None | 0 0
  1. <?php
  2. if (!function_exists('fix_angka'))
  3. {
  4.     function fix_angka($string)
  5.     {
  6.         $string = str_replace(',', '', $string);
  7.         $string = strtok($string, '.');
  8.         return $string;
  9.     }
  10. }
  11. function grab_bca($user, $pass)
  12. {
  13.     $user_ip = '202.62.16.186';
  14.     $ua = "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) '.
  15.    Chrome/44.0.2403.89 Safari/537.36";
  16.     $cookie = APP_PATH . 'bca-cookie.txt';
  17.  
  18.     $ch = curl_init();
  19.  
  20.     curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
  21.     curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
  22.     curl_setopt($ch, CURLOPT_USERAGENT, $ua);
  23.     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  24.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  25.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
  26.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  27.     curl_setopt($ch, CURLOPT_URL, 'https://ibank.klikbca.com');
  28.     $info = curl_exec($ch);
  29.  
  30.     $a = strstr($info, 'var s = document.createElement(\'script\'), attrs = { src: (window.location.protocol ==',
  31.         1);
  32.     $a = strstr($a, 'function getCurNum(){');
  33.  
  34.     $b = array(
  35.         'return "',
  36.         'function getCurNum(){',
  37.         '";',
  38.         '}',
  39.         '{',
  40.         '(function()',
  41.         );
  42.  
  43.     $b = str_replace($b, '', $a);
  44.     $curnum = trim($b);
  45.     $params = 'value%28actions%29=login&value%28user_id%29=' . $user .
  46.         '&value%28CurNum%29=' . $curnum . '&value%28user_ip%29=' . $user_ip .
  47.         '&value%28browser_info%29=' . $ua . '&value%28mobile%29=false&value%28pswd%29=' .
  48.         $pass . '&value%28Submit%29=LOGIN';
  49.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
  50.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  51.     curl_setopt($ch, CURLOPT_URL, 'https://ibank.klikbca.com/authentication.do');
  52.     curl_setopt($ch, CURLOPT_REFERER, 'https://ibank.klikbca.com');
  53.     curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
  54.     curl_setopt($ch, CURLOPT_POST, 1);
  55.     $info = curl_exec($ch);
  56.  
  57.     // Buka menu
  58.     curl_setopt($ch, CURLOPT_URL,
  59.         'https://ibank.klikbca.com/nav_bar_indo/menu_bar.htm');
  60.     curl_setopt($ch, CURLOPT_REFERER, 'https://ibank.klikbca.com/authentication.do');
  61.     $info = curl_exec($ch);
  62.  
  63.     // Buka Informasi Rekening
  64.     curl_setopt($ch, CURLOPT_URL,
  65.         'https://ibank.klikbca.com/nav_bar_indo/account_information_menu.htm');
  66.     curl_setopt($ch, CURLOPT_REFERER, 'https://ibank.klikbca.com/authentication.do');
  67.     $info = curl_exec($ch);
  68.  
  69.     // Buka Mutasi Rekening
  70.     curl_setopt($ch, CURLOPT_URL,
  71.         'https://ibank.klikbca.com/accountstmt.do?value(actions)=acct_stmt');
  72.     curl_setopt($ch, CURLOPT_REFERER,
  73.         'https://ibank.klikbca.com/nav_bar_indo/account_information_menu.htm');
  74.     curl_setopt($ch, CURLOPT_POST, 1);
  75.     $info = curl_exec($ch);
  76.  
  77.     // Parameter untuk Lihat Mutasi Rekening
  78.     $params = array();
  79.  
  80.     $jkt_time = time() + (3600 * 7);
  81.     $t1 = explode('-', date('Y-m-d', $jkt_time));
  82.     $t0 = explode('-', date('Y-m-d', $jkt_time - (3600 * 24)));
  83.  
  84.     $params[] = 'value%28startDt%29=' . $t0[2];
  85.     $params[] = 'value%28startMt%29=' . $t0[1];
  86.     $params[] = 'value%28startYr%29=' . $t0[0];
  87.     $params[] = 'value%28endDt%29=' . $t1[2];
  88.     $params[] = 'value%28endMt%29=' . $t1[1];
  89.     $params[] = 'value%28endYr%29=' . $t1[0];
  90.     $params[] = 'value%28D1%29=0';
  91.     $params[] = 'value%28r1%29=1';
  92.     $params[] = 'value%28fDt%29=';
  93.     $params[] = 'value%28tDt%29=';
  94.     $params[] = 'value%28submit1%29=Lihat+Mutasi+Rekening';
  95.  
  96.     $params = implode('&', $params);
  97.  
  98.     // Buka Lihat Mutasi Rekening & simpan hasilnya di $source
  99.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
  100.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  101.     curl_setopt($ch, CURLOPT_URL,
  102.         'https://ibank.klikbca.com/accountstmt.do?value(actions)=acctstmtview');
  103.     curl_setopt($ch, CURLOPT_REFERER,
  104.         'https://ibank.klikbca.com/nav_bar_indo/account_information_menu.htm');
  105.     curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
  106.     curl_setopt($ch, CURLOPT_POST, 1);
  107.  
  108.     $source = curl_exec($ch);
  109.  
  110.     // Logout, cURL close, hapus cookies
  111.     curl_setopt($ch, CURLOPT_URL,
  112.         'https://ibank.klikbca.com/authentication.do?value(actions)=logout');
  113.     curl_setopt($ch, CURLOPT_REFERER,
  114.         'https://ibank.klikbca.com/nav_bar_indo/account_information_menu.htm');
  115.     $info = curl_exec($ch);
  116.     curl_close($ch);
  117.     @unlink($cookie);
  118.     return $source;
  119. }
  120.  
  121.     function check_bca($jumlah){
  122.     global $pdo;
  123.     $user = "uhamadri6545"; //Masukkan username akun KlikBCA
  124.     $pass = "170988"; //Masukkan password akun KlikBCA
  125.     $source = grab_bca($user, $pass);
  126.   //  exit($source);
  127.     $exp = explode('<b>Saldo</b></font></div></td>', $source);
  128.     $invoices = array();
  129.     $lunas = array();
  130.     $jkt_time = time() + (3600 * 7);
  131.     $tahun = date('Y', $jkt_time);
  132.     if (isset($exp[1]))
  133.     {
  134.         $table = explode("</table>", $exp[1]);
  135.         $tr = explode("<tr>", $table[0]);
  136.         for ($i = 1; $i < count($tr); $i++)
  137.         {
  138.             $str = str_ireplace('</font>', '#~#~#</font>', $tr[$i]);
  139.             $str = str_ireplace('<br>', '<br> ', $str);
  140.             $str = preg_replace('!\s+!', ' ', trim(strip_tags($str)));
  141.             $arr = array_map('trim', explode("#~#~#", $str));
  142.             $tgl = $arr[0] . '/' . $tahun;
  143.             $keterangan = $arr[1];
  144.             $kredit = fix_angka($arr[3]);
  145.             $status = $arr[4];
  146.             if($kredit == $jumlah){
  147.             $result = "sukses";
  148.             }
  149.         }
  150.         return $result;
  151.     }
  152.     }
  153. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement