Kamis, 06 Januari 2011

Script script php grap data saldo BCA

<?    
        
/* **************************** */
        //Login Information     
        /* **************************** */
        //Your Account ID
        
$user_id 'isi dengan id anda';
        
//Your Account Password
        
$pswd 'isi password anda';
        
//Your webserver IP Address, from where this script will run
        
$server_ip 'xxx.xx.xx.xx';
        
        
/* **************************** */
        //Login page - we are simulating browser in script
        /* **************************** */
        
$ch curl_init();
        
//variable for cookies access
        
curl_setopt($chCURLOPT_COOKIEJAR$cookiesjar);    
        
//variable for cookies store , same as previous line
        
curl_setopt($chCURLOPT_COOKIEFILE$cookiesjar);    
        
//simulating user agent - shadow
        
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"); 
        
//skipping SSL_CERT for host
        
curl_setopt($chCURLOPT_SSL_VERIFYHOST0);
        
//skipping SSL_CERT 
        
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);    
        
//ingroring server redirect
        
curl_setopt($chCURLOPT_FOLLOWLOCATION0);
        
//accepting returns from server
        
curl_setopt($chCURLOPT_RETURNTRANSFER1);    
        
//our target url
        
curl_setopt($chCURLOPT_URL"https://ibank.klikbca.com");
        
//open the url with our mentioned variables
        
$info curl_exec($ch);
        
        

        
/* **************************** */
        //Submitting Login information
        /* **************************** */
        //form fields are listed here to submit into login page for authentication, it is urlencoded
        
$params "value%28actions%29=login&value%28user_id%29=$user_id&value%28user_ip%29=$server_ip&value%28pswd%29=$pswd&value%28Submit%29=LOGIN";
                
        
curl_setopt($chCURLOPT_FOLLOWLOCATION0);
        
curl_setopt($chCURLOPT_RETURNTRANSFER1);    
        
curl_setopt($chCURLOPT_URL"https://ibank.klikbca.com/authentication.do");
        
//referer - from where we came to this page, important
        
curl_setopt($chCURLOPT_REFERER"https://ibank.klikbca.com");
        
//post field values
        
curl_setopt($chCURLOPT_POSTFIELDS,$params);        
        
//do post the form, not get
        
curl_setopt($chCURLOPT_POST1);        
        
$info curl_exec($ch);
        
        
        
/* **************************** */
        //opening menu page - as like as real user
        /* **************************** */
        
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);


        
/* **************************** */
        //opening account page - as like as real user
        /* **************************** */
        
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);
        
        
        
/* **************************** */
        //trick revealed, they used javascript post to activate the link
        /* **************************** */
        
$params '';
        
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_POST1);
        
$source curl_exec($ch);


        
/* **************************** */
        //logging out
        /* **************************** */        
        
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);    
        
        
        
/* **************************** */
        //page content are extracting for otput
        /* **************************** */
        
preg_match_all('/<table border="0" cellpadding="0" cellspacing="0" width="590">.*?<\/table>/sim',$source,$matches);
        
$table $matches[0][1];
        
//page to table extracted
        
preg_match_all('/<tr>.*?<\/tr>/sim',$table,$matches);
        
$tr2 $matches[0][1];
        
//table to row extracted
        
preg_match_all('/<td .*?>\s+ .*?<font .*?>\s+(.*?)\s+<\/font>.*?<td .*? <td .*? <td .*? <font .*?>\s+(.*?)\s+<\/font>/sim',$table,$matches);
        
array_shift($matches);
        
        
//see the array
        
echo '<pre>';
        
print_r($matches);
        
//echo 'Balance: ' . $matches[0][1] . ';' . $matches[1][1];         ?>



cek history BCA nya

<?    
               
include 'tabel_extractor.php';    

        
//Your Account ID
        
$user_id 'abcdefgh1234';
        
//Your Account Password
        
$pswd 'xxxxxx';
        
//Your webserver IP Address, from where this script will run
        
$server_ip 'xxx.xx.xx.xx';
        
        
//Initialize your input from url
        //value%28D1%29=0&value%28startDt%29=10&value%28startMt%29=1&value%28startYr%29=2009&value%28endDt%29=10&value%28endMt%29=2&value%28endYr%29=2009&value%28submit2%29=Download+Mutasi
        
$report_type trim(strtolower($_REQUEST['s']));
        
$str_start_date trim($_REQUEST['d1']);
        
$str_end_date trim($_REQUEST['d2']);
        
$download_csv trim($_REQUEST['dl']);
        
        if(
$report_type == 'intv') {    
            
//splitting start date to Year, Month and Day
            
preg_match('/(\d\d\d\d)(\d\d)(\d\d)/'$str_start_date$start_dates);
            
array_shift($start_dates);
            
            
$startYr = (int) $start_dates[0];
            
$startMt = (int) $start_dates[1];
            
$startDt = (int) $start_dates[2];
            
            
//splitting end date to Year, Month and Day
            
preg_match('/(\d\d\d\d)(\d\d)(\d\d)/'$str_end_date$end_dates);
            
array_shift($end_dates);            

            
$endYr = (int) $end_dates[0];
            
$endMt = (int) $end_dates[1];
            
$endDt = (int) $end_dates[2];
            
        } 
        else  {
            
$startYr $endYr date('Y');
            
$startMt $endMt = (int) date('m');
            
$startDt $endDt = (int) date('d');    
        }
        
$download_params "value%28D1%29=0&value%28startDt%29=$startDt&value%28startMt%29=$startMt&value%28startYr%29=$startYr&value%28endDt%29=$endDt&value%28endMt%29=$endMt&value%28endYr%29=$endYr&value%28submit2%29=Download+Mutasi";

        
        
/* **************************** */
        //Login page - we are simulating browser in script
        /* **************************** */
        
$ch curl_init();
        
//variable for cookies access
        
curl_setopt($chCURLOPT_COOKIEJAR$cookiesjar);    
        
//variable for cookies store , same as previous line
        
curl_setopt($chCURLOPT_COOKIEFILE$cookiesjar);    
        
//simulating user agent - shadow
        
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"); 
        
//skipping SSL_CERT for host
        
curl_setopt($chCURLOPT_SSL_VERIFYHOST0);
        
//skipping SSL_CERT 
        
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);    
        
//ingroring server redirect
        
curl_setopt($chCURLOPT_FOLLOWLOCATION0);
        
//accepting returns from server
        
curl_setopt($chCURLOPT_RETURNTRANSFER1);    
        
//our target url
        
curl_setopt($chCURLOPT_URL"https://ibank.klikbca.com");
        
//open the url with our mentioned variables
        
$info curl_exec($ch);
        
        

        
/* **************************** */
        //Submitting Login information
        /* **************************** */
        //form fields are listed here to submit into login page for authentication, it is urlencoded
        
$params "value%28actions%29=login&value%28user_id%29=$user_id&value%28user_ip%29=$server_ip&value%28pswd%29=$pswd&value%28Submit%29=LOGIN";
                
        
curl_setopt($chCURLOPT_FOLLOWLOCATION0);
        
curl_setopt($chCURLOPT_RETURNTRANSFER1);    
        
curl_setopt($chCURLOPT_URL"https://ibank.klikbca.com/authentication.do");
        
//referer - from where we came to this page, important
        
curl_setopt($chCURLOPT_REFERER"https://ibank.klikbca.com");
        
//post field values
        
curl_setopt($chCURLOPT_POSTFIELDS,$params);        
        
//do post the form, not get
        
curl_setopt($chCURLOPT_POST1);        
        
$info curl_exec($ch);
        
        
        
/* **************************** */
        //opening menu page - as like as real user
        /* **************************** */
        
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);


        
/* **************************** */
        //opening account page - as like as real user
        /* **************************** */
        
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);
        
        
        
/* **************************** */
        //trick revealed, they used javascript post to activate the link
        /* **************************** */
        
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");
        
$info curl_exec($ch);
        
        
        
/* **************************** */
        /* Downloading CSV file*/
        /* **************************** */
        //curl_setopt($ch, CURLOPT_URL, "https://ibank.klikbca.com/stmtdownload.do?value(actions)=account_statement");
        
curl_setopt($chCURLOPT_URL"https://ibank.klikbca.com/accountstmt.do?value(actions)=acctstmtview");
        
curl_setopt($chCURLOPT_REFERER"https://ibank.klikbca.com/accountstmt.do?value(actions)=acct_stmt");
        
curl_setopt($chCURLOPT_POSTFIELDS$download_params);    
        
curl_setopt($chCURLOPT_POST1);
        
$source curl_exec($ch);
        
$source2 $source;

        
/* **************************** */
        //logging out
        /* **************************** */        
        
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);    
        
        
$tbl = new tableExtractor
        
$tbl->source $source// Set the HTML Document 
        
$tbl->anchor 'IDR'// Set an anchor that is unique and occurs before the Table 
        
$tpl->anchorWithin true// To use a unique anchor within the table to be retrieved 
        
$d $tbl->extractTable(); // The array
        

        
$source preg_replace('/(.*?)Tanggal,Keterangan,Cabang,Jumlah,,Saldo/sim',''$source);
        
$source preg_replace('/Saldo .*?Akhir,=,\w+.\w+/sim',''$source);
        
$source "Tanggal,Keterangan,Cabang,Jumlah,,Saldo \n" $source;
        
        
//cleaning extra single qoute
        
$source preg_replace("/'/sim"''$source);
        
        if(
$download_csv) {
            
header("Content-type: text/csv");
            
header("Content-Type: application/force-download");
            
header("Content-Type: application/download");
            
header("Content-Description: File Transfer"); 
            
header("Content-Length: "strlen($source));
            
header("Content-Disposition: attachment; filename=history.csv");    
        }
        else { 
            echo 
'<pre>'
            
print_r($d);
        }

 
?>
 



tabel extractor.php

<? 
  /*----------------------------------------------------------------------
        Table Extractor
        ===============
        Table extractor is a php class that can extract almost any table
        from any html document/page, and then convert that html table into
        a php array.
        
        Version 1.3
        Compatibility: PHP 4.4.1 +
        Copyright Jack Sleight - www.reallyshiny.com
        This script is licensed under the Creative Commons License.
    ----------------------------------------------------------------------*/
 
    class tableExtractor {
    
        var $source            = NULL;
        var $anchor            = NULL;
        var $anchorWithin    = false;
        var $headerRow        = true;
        var $startRow        = 0;
        var $maxRows        = 0;
        var $startCol        = 0;
        var $maxCols        = 0;
        var $stripTags        = false;
        var $extraCols        = array();
        var $rowCount        = 0;
        var $dropRows        = NULL;
        
        var $cleanHTML        = NULL;
        var $rawArray        = NULL;
        var $finalArray        = NULL;
        
        function extractTable() {
        
            $this->cleanHTML();
            $this->prepareArray();
            
            return $this->createArray();
            
        }
    
 
        function cleanHTML() {
        
            // php 4 compatibility functions
            if(!function_exists('stripos')) {
                function stripos($haystack,$needle,$offset = 0) {
                   return(strpos(strtolower($haystack),strtolower($needle),$offset));
                }
            }
                        
            // find unique string that appears before the table you want to extract
            if ($this->anchorWithin) {
                /*------------------------------------------------------------
                    With thanks to Khary Sharp for suggesting and writing
                    the anchor within functionality.
                ------------------------------------------------------------*/                
                $anchorPos = stripos($this->source, $this->anchor) + strlen($this->anchor);
                $sourceSnippet = strrev(substr($this->source, 0, $anchorPos));
                $tablePos = stripos($sourceSnippet, strrev(("<table"))) + 6;
                $startSearch = strlen($sourceSnippet) - $tablePos;
            }                       
            else {
                $startSearch = stripos($this->source, $this->anchor);
            }
        
            // extract table
            $startTable = stripos($this->source, '<table', $startSearch);
            $endTable = stripos($this->source, '</table>', $startTable) + 8;
            $table = substr($this->source, $startTable, $endTable - $startTable);
        
            if(!function_exists('lcase_tags')) {
                function lcase_tags($input) {
                    return strtolower($input[0]);
                }
            }
            
            // lowercase all table related tags
            $table = preg_replace_callback('/<(\/?)(table|tr|th|td)/is', 'lcase_tags', $table);
            
            // remove all thead and tbody tags
            $table = preg_replace('/<\/?(thead|tbody).*?>/is', '', $table);
            
            // replace th tags with td tags
            $table = preg_replace('/<(\/?)th(.*?)>/is', '<$1td$2>', $table);
                                    
            // clean string
            $table = trim($table);
            $table = str_replace("\r\n", "", $table); 
                            
            $this->cleanHTML = $table;
        
        }
        
        function prepareArray() {
        
            // split table into individual elements
            $pattern = '/(<\/?(?:tr|td).*?>)/is';
            $table = preg_split($pattern, $this->cleanHTML, -1, PREG_SPLIT_DELIM_CAPTURE);    
 
            // define array for new table
            $tableCleaned = array();
            
            // define variables for looping through table
            $rowCount = 0;
            $colCount = 1;
            $trOpen = false;
            $tdOpen = false;
            
            // loop through table
            foreach($table as $item) {
            
                // trim item
                $item = str_replace(' ', '', $item);
                $item = trim($item);
                
                // save the item
                $itemUnedited = $item;
                
                // clean if tag                                    
                $item = preg_replace('/<(\/?)(table|tr|td).*?>/is', '<$1$2>', $item);
 
                // pick item type
                switch ($item) {
                    
 
                    case '<tr>':
                        // start a new row
                        $rowCount++;
                        $colCount = 1;
                        $trOpen = true;
                        break;
                        
                    case '<td>':
                        // save the td tag for later use
                        $tdTag = $itemUnedited;
                        $tdOpen = true;
                        break;
                        
                    case '</td>':
                        $tdOpen = false;
                        break;
                        
                    case '</tr>':
                        $trOpen = false;
                        break;
                        
                    default :
                    
                        // if a TD tag is open
                        if($tdOpen) {
                        
                            // check if td tag contained colspan                                            
                            if(preg_match('/<td [^>]*colspan\s*=\s*(?:\'|")?\s*([0-9]+)[^>]*>/is', $tdTag, $matches))
                                $colspan = $matches[1];
                            else
                                $colspan = 1;
                                                    
                            // check if td tag contained rowspan
                            if(preg_match('/<td [^>]*rowspan\s*=\s*(?:\'|")?\s*([0-9]+)[^>]*>/is', $tdTag, $matches))
                                $rowspan = $matches[1];
                            else
                                $rowspan = 0;
                                
                            // loop over the colspans
                            for($c = 0; $c < $colspan; $c++) {
                                                    
                                // if the item data has not already been defined by a rowspan loop, set it
                                if(!isset($tableCleaned[$rowCount][$colCount]))
                                    $tableCleaned[$rowCount][$colCount] = $item;
                                else
                                    $tableCleaned[$rowCount][$colCount + 1] = $item;
                                    
                                // create new rowCount variable for looping through rowspans
                                $futureRows = $rowCount;
                                
                                // loop through row spans
                                for($r = 1; $r < $rowspan; $r++) {
                                    $futureRows++;                                    
                                    if($colspan > 1)
                                        $tableCleaned[$futureRows][$colCount + 1] = $item;
                                    else                    
                                        $tableCleaned[$futureRows][$colCount] = $item;
                                }
    
                                // increase column count
                                $colCount++;
                            
                            }
                            
                            // sort the row array by the column keys (as inserting rowspans screws up the order)
                            ksort($tableCleaned[$rowCount]);
                        }
                        break;
                }    
            }
            // set row count
            if($this->headerRow)
                $this->rowCount    = count($tableCleaned) - 1;
            else
                $this->rowCount    = count($tableCleaned);
            
            $this->rawArray = $tableCleaned;
            
        }
        
        function createArray() {
            
            // define array to store table data
            $tableData = array();
            
            // get column headers
            if($this->headerRow) {
            
                // trim string
                $row = $this->rawArray[$this->headerRow];
                            
                // set column names array
                $columnNames = array();
                $uniqueNames = array();
                        
                // loop over column names
                $colCount = 0;
                foreach($row as $cell) {
                                
                    $colCount++;
                    
                    $cell = strip_tags($cell);
                    $cell = trim($cell);
                    
                    // save name if there is one, otherwise save index
                    if($cell) {
                    
                        if(isset($uniqueNames[$cell])) {
                            $uniqueNames[$cell]++;
                            $cell .= ' ('.($uniqueNames[$cell] + 1).')';    
                        }            
                        else {
                            $uniqueNames[$cell] = 0;
                        }
 
                        $columnNames[$colCount] = $cell;
                        
                    }                        
                    else
                        $columnNames[$colCount] = $colCount;
                    
                }
                
                // remove the headers row from the table
                unset($this->rawArray[$this->headerRow]);
    
            }
            
            // remove rows to drop
            foreach(explode(',', $this->dropRows) as $key => $value) {
                unset($this->rawArray[$value]);
            }
                                
            // set the end row
            if($this->maxRows)
                $endRow = $this->startRow + $this->maxRows - 1;
            else
                $endRow = count($this->rawArray);
                
            // loop over row array
            $rowCount = 0;
            $newRowCount = 0;                            
            foreach($this->rawArray as $row) {
            
                $rowCount++;
                
                // if the row was requested then add it
                if($rowCount >= $this->startRow && $rowCount <= $endRow) {
                
                    $newRowCount++;
                                    
                    // create new array to store data
                    $tableData[$newRowCount] = array();
                    
                    //$tableData[$newRowCount]['origRow'] = $rowCount;
                    //$tableData[$newRowCount]['data'] = array();
                    $tableData[$newRowCount] = array();
                    
                    // set the end column
                    if($this->maxCols)
                        $endCol = $this->startCol + $this->maxCols - 1;
                    else
                        $endCol = count($row);
                    
                    // loop over cell array
                    $colCount = 0;
                    $newColCount = 0;                                
                    foreach($row as $cell) {
                    
                        $colCount++;
                        
                        // if the column was requested then add it
                        if($colCount >= $this->startCol && $colCount <= $endCol) {
                    
                            $newColCount++;
                            
                            if($this->extraCols) {
                                foreach($this->extraCols as $extraColumn) {
                                    if($extraColumn['column'] == $colCount) {
                                        if(preg_match($extraColumn['regex'], $cell, $matches)) {
                                            if(is_array($extraColumn['names'])) {
                                                $this->extraColsCount = 0;
                                                foreach($extraColumn['names'] as $extraColumnSub) {
                                                    $this->extraColsCount++;
                                                    $tableData[$newRowCount][$extraColumnSub] = $matches[$this->extraColsCount];
                                                }                                        
                                            } else {
                                                $tableData[$newRowCount][$extraColumn['names']] = $matches[1];
                                            }
                                        } else {
                                            $this->extraColsCount = 0;
                                            if(is_array($extraColumn['names'])) {
                                                $this->extraColsCount = 0;
                                                foreach($extraColumn['names'] as $extraColumnSub) {
                                                    $this->extraColsCount++;
                                                    $tableData[$newRowCount][$extraColumnSub] = '';
                                                }                                        
                                            } else {
                                                $tableData[$newRowCount][$extraColumn['names']] = '';
                                            }
                                        }
                                    }
                                }
                            }
                            
                            if($this->stripTags)        
                                $cell = strip_tags($cell);
                            
                            // set the column key as the column number
                            $colKey = $newColCount;
                            
                            // if there is a table header, use the column name as the key
                            if($this->headerRow)
                                if(isset($columnNames[$colCount]))
                                    $colKey = $columnNames[$colCount];
                            
                            // add the data to the array
                            //$tableData[$newRowCount]['data'][$colKey] = $cell;
                            $tableData[$newRowCount][$colKey] = $cell;
                        }
                    }
                }
            }
                    
            $this->finalArray = $tableData;
            return $tableData;
        }    
    }
?>
 

4 komentar:

  1. Tak ada skrip buat grab mutasi BRI ya say

    BalasHapus
  2. Solusi online payment Anda: Layanan Ambil Mutasi Bank Otomatis

    Kami menghandle pengecekan mutasi bank Anda. Anda akan menerima Notifikasi jika ada mutasi baru dikirim via email dan url callback sehingga sistem approval order/tiket/deposit dapat berjalan autopilot (otomatis) tanpa perlu ada cs dibelakang monitor..

    Menjadikan bisnis Anda lebih hemat, dan meningkatkan trust customer Anda.

    Support bank BCA, Mandiri, BNI, BRI, Muamalat. Pengecekan dalam hitungan detik

    Sangat cocok untuk bisnis server pulsa, online shop, online payment, bisnis membership, dll

    Ada FREE TRIAL 7 Hari!!!

    Langsung ke tkp https://mesinotomatis.com/

    BalasHapus
  3. mantap jalan, amakasih yah bis

    BalasHapus