Advertisement
Guest User

Untitled

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