You Now Here »

Tutorial PHP automatic get payment history mutasi transaksi BCA Bank  (Read 5849 times - 163 votes) 

DANNY

G-Plus Author
  • ADMINISTRATOR
  • More Share Forum Topic
  • [MS] kepala suku
  • *
  • DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!
  • Rep Power: 6
  • Join: September 30, 2009
  • Posts: 11,931
  • Poin: 194.149
    • WWW
  • IP member tracker Logged


save dulu ah...
blm ane test loh ini... ntar kapan2 ane test
jd yg mau test no komplen sampe ane udh test work or engga nya
  :beer:

Code: [Select]
<?php


error_reporting
E_ALL );

$user   = '';
$pass   = '';
$mail   = '@gmail.com';

$user_ip 'ip.server';
$time time() + 54000;
//echo '<pre>'.print_r( $_SERVER['SERVER_ADDR'], true ).'</pre>'; die();




// Buka halaman login

$ch curl_init();
curl_setopt$chCURLOPT_COOKIEJAR'cookiejar' );    
curl_setopt$chCURLOPT_COOKIEFILE'cookiejar' );
curl_setopt$chCURLOPT_USERAGENT'Mozilla/5.0 ( Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1 ) Gecko/20061204 Firefox/2.0.0.1' );
curl_setopt$chCURLOPT_SSL_VERIFYHOST);
curl_setopt$chCURLOPT_SSL_VERIFYPEER);
curl_setopt$chCURLOPT_FOLLOWLOCATION);
curl_setopt$chCURLOPT_RETURNTRANSFER);
curl_setopt$chCURLOPT_URL'https://ibank.klikbca.com' );
$info curl_exec$ch );




// Login

$params 'value%28actions%29=login&value%28user_id%29=' $user '&value%28user_ip%29=' $user_ip '&value%28pswd%29=' $pass '&value%28Submit%29=LOGIN';
curl_setopt$chCURLOPT_FOLLOWLOCATION);
curl_setopt$chCURLOPT_RETURNTRANSFER);
curl_setopt$chCURLOPT_URL'https://ibank.klikbca.com/authentication.do' );
curl_setopt$chCURLOPT_REFERER'https://ibank.klikbca.com' );
curl_setopt$chCURLOPT_POSTFIELDS$params );
curl_setopt$chCURLOPT_POST);
$info curl_exec$ch );




// Buka menu

curl_setopt$chCURLOPT_URL'https://ibank.klikbca.com/nav_bar_indo/menu_bar.htm' );
curl_setopt$chCURLOPT_REFERER'https://ibank.klikbca.com/authentication.do' );
$info curl_exec$ch );




// Buka Informasi Rekening

curl_setopt$chCURLOPT_URL'https://ibank.klikbca.com/nav_bar_indo/account_information_menu.htm' );
curl_setopt$chCURLOPT_REFERER'https://ibank.klikbca.com/authentication.do' );
$info curl_exec$ch );




// Buka Mutasi Rekening

curl_setopt$chCURLOPT_URL'https://ibank.klikbca.com/accountstmt.do?value( actions )=acct_stmt' );
curl_setopt$chCURLOPT_REFERER'https://ibank.klikbca.com/nav_bar_indo/account_information_menu.htm' );
curl_setopt$chCURLOPT_POST);
$info curl_exec$ch );




// Parameter untuk Lihat Mutasi Rekening
   
$params = array();
   
$t1 explode'-'date'Y-m-d'$time ) );
$t0 explode'-'date'Y-m-d'$time 604800 ) );

$params[] = 'value%28startDt%29=' $t0[2];
$params[] = 'value%28startMt%29=' $t0[1];
$params[] = 'value%28startYr%29=' $t0[0];
$params[] = 'value%28endDt%29=' $t1[2];
$params[] = 'value%28endMt%29=' $t1[1];
$params[] = 'value%28endYr%29=' $t1[0];
$params[] = 'value%28D1%29=0';
$params[] = 'value%28r1%29=1';
$params[] = 'value%28fDt%29=';
$params[] = 'value%28tDt%29=';
$params[] = 'value%28submit1%29=Lihat+Mutasi+Rekening';

$params implode'&'$params );




// Buka Lihat Mutasi Rekening & simpan hasilnya di $source
   
curl_setopt$chCURLOPT_FOLLOWLOCATION);
curl_setopt$chCURLOPT_RETURNTRANSFER);
curl_setopt$chCURLOPT_URL'https://ibank.klikbca.com/accountstmt.do?value(actions)=acctstmtview' );
curl_setopt$chCURLOPT_REFERER'https://ibank.klikbca.com/nav_bar_indo/account_information_menu.htm' );
curl_setopt$chCURLOPT_POSTFIELDS$params );
curl_setopt$chCURLOPT_POST);

$source curl_exec$ch );




// Logout, cURL close, hapus cookies

curl_setopt$chCURLOPT_URL'https://ibank.klikbca.com/authentication.do?value(actions)=logout' );
curl_setopt$chCURLOPT_REFERER'https://ibank.klikbca.com/nav_bar_indo/account_information_menu.htm' );
$info curl_exec$ch );
curl_close$ch );
unlink'cookiejar' );




// Parse $source

$source array_sliceexplode'<b>Saldo</b></font></div></td>'$source ), );




// Ga ada transaksi? BCA error?

if ( isset( $source[0] ) )
{




   // Rapiin

   $source array_sliceexplode'</tr>' "\r\n" '</table>  </td></tr><tr>'$source[0] ), 0);
   $source array_sliceexplode'</tr>' "\r\n" '<tr>'$source[0] ), );
   
   foreach( $source as $key => $val )
   {
   
      preg_match_all'/<font face="verdana" size="1" color="#0000bb">(.*?)<\/font>/sim'$val$matches );
      
      

      
      // Rapiin lagi
      
      foreach( $matches[1] as $k => $v )
      {      
         $v trimpreg_replace'/\s*(<br>)\s*/''<br />'$v ) );         
         $matches[0][$k] = $v;      
      }
      
      $source[$key] = implode'|'$matches[0] );

   }
   
   
   
   
   // Ambil catetan
   
   $db dirname__FILE__ ) . '/prev.txt';
   $prev = array();
   if ( file_exists$db ) )
   {
      $prev file$dbFILE_IGNORE_NEW_LINES );
   }
   else
   {
      touch$db );
   }
   
   
   
   
   // Bandingin
   
   $diff = array();
   
   foreach( $source as $val )
   {
      if ( !in_array$val$prev ) )
      {
         $diff[] = $val;
      }
   }
   
   
   
   
   // Update catetan
   
   $fh fopen$db'w' );
   fwrite$fhimplode"\n"$source ) );
   fclose$fh );
   
   
   
   
   //echo '<pre>'.print_r( $source, true ).'</pre>';
   //echo '<pre>'.print_r( $prev, true ).'</pre>';
   //echo '<pre>'.print_r( $diff, true ).'</pre>';
   
   
   
   
   // Kirim email kalau ada perubahan
   
   $body '';
   
   if ( !empty( $diff ) )
   {
      
      $body .= '====================================' "\n\n";
         
      foreach( $diff as $val )
      {
         
         $val explode'|'$val );
         
         $body .= 'Tanggal/Status: ' $val[0] . "\n";
         $body .= 'Jenis: ' $val[4] . "\n";
         $body .= 'Jumlah: ' $val[3] . "\n";
         $body .= "\n" str_replace'<br />'"\n"$val[1] ) . "\n\n";
         $body .= '====================================' "\n\n";
         
      }
      
      
      
   }
   
   
   
   
   
   
   

}
?>


View Mobile Web Short URL:

DANNY

G-Plus Author
  • ADMINISTRATOR
  • More Share Forum Topic
  • [MS] kepala suku
  • *
  • DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!
  • Rep Power: 6
  • Join: September 30, 2009
  • Posts: 11,931
  • Poin: 194.149
    • WWW
  • IP member tracker Logged
Re: Tutorial PHP automatic get payment history mutasi transaksi BCA Bank
« Reply #1 on: June 11, 2013, 11:42:46 PM »
UPDATE
SCRIPT WORKING

DIBAWAH INI ANE UDAH COBA MODIF SCRIPT DIATAS HANYA UNTUK MELIHAT SALDO
  :keren:keren:keren

Code: [Select]
<?php
error_reporting
(0);

$user 'USERNAME_BCA';
$pass 'PASSWORD_BCA';

$user_ip $_SERVER['SERVER_ADDR'];
$time time() + 54000;

// Buka halaman login
$ch curl_init();
curl_setopt$chCURLOPT_COOKIEJAR'cookiejar' );    
curl_setopt$chCURLOPT_COOKIEFILE'cookiejar' );
curl_setopt$chCURLOPT_USERAGENT'Mozilla/5.0 ( Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1 ) Gecko/20061204 Firefox/2.0.0.1' );
curl_setopt$chCURLOPT_SSL_VERIFYHOST);
curl_setopt$chCURLOPT_SSL_VERIFYPEER);
curl_setopt$chCURLOPT_FOLLOWLOCATION);
curl_setopt$chCURLOPT_RETURNTRANSFER);
curl_setopt$chCURLOPT_URL'https://ibank.klikbca.com' );
$info curl_exec$ch );

// Login
$params 'value%28actions%29=login&value%28user_id%29=' $user '&value%28user_ip%29=' $user_ip '&value%28pswd%29=' $pass '&value%28Submit%29=LOGIN';
curl_setopt$chCURLOPT_FOLLOWLOCATION);
curl_setopt$chCURLOPT_RETURNTRANSFER);
curl_setopt$chCURLOPT_URL'https://ibank.klikbca.com/authentication.do' );
curl_setopt$chCURLOPT_REFERER'https://ibank.klikbca.com' );
curl_setopt$chCURLOPT_POSTFIELDS$params );
curl_setopt$chCURLOPT_POST);
$info curl_exec$ch );

// Buka menu
curl_setopt$chCURLOPT_URL'https://ibank.klikbca.com/nav_bar_indo/menu_bar.htm' );
curl_setopt$chCURLOPT_REFERER'https://ibank.klikbca.com/authentication.do' );
$info curl_exec$ch );

// Buka Informasi Rekening
curl_setopt$chCURLOPT_URL'https://ibank.klikbca.com/nav_bar_indo/account_information_menu.htm' );
curl_setopt$chCURLOPT_REFERER'https://ibank.klikbca.com/authentication.do' );
$info curl_exec$ch );

// Buka Mutasi Rekening
curl_setopt$chCURLOPT_URL'https://ibank.klikbca.com/balanceinquiry.do' );
curl_setopt$chCURLOPT_REFERER'https://ibank.klikbca.com/nav_bar_indo/account_information_menu.htm' );
curl_setopt$chCURLOPT_POST);
$source curl_exec$ch );

// Logout, cURL close, hapus cookies
curl_setopt$chCURLOPT_URL'https://ibank.klikbca.com/authentication.do?value(actions)=logout' );
curl_setopt$chCURLOPT_REFERER'https://ibank.klikbca.com/nav_bar_indo/account_information_menu.htm' );
$info curl_exec$ch );
curl_close$ch );
unlink'cookiejar' );

$source preg_replace('/(\\n|\\r)/','',$source);
$source preg_replace('/\s\s+/',' ',$source);
@
preg_match_all('/IDR(.*?) <\/font> <\/div> <\/td> <\/tr> <\/table>/',$source,$saldo);
$source preg_replace('/<(.*?)>/','',$saldo[1][0]);
$saldoakhir preg_replace('/\s\s+/','',$source);

echo 
$saldoakhir;
?>