Online Store Shopping

Cari Produk Di Sini

Katalog Produk

10-latest-1110px-slider

Area Jelajah Marketing

Flag Counter

Total Pengunjung

cURL + KlikBCA PHP My SQL

Ini adalah kode cURL utk klikbca.com
Di sini kita bisa cek saldo + cek mutasi rekening, tentu aja harus sediain info login juga

Oke, ini file2nya.


klikbca.class.php

<?php //
// Author : 
http://www.astergroup.co.cc 
// URL : 
http://www.astergroup.co.cc 
// 
define('URL_LOGIN''https://ibank.klikbca.com/authentication.do'); define('URL_SALDO''https://ibank.klikbca.com/balanceinquiry.do'); define('URL_MUTASI_INDEX''https://ibank.klikbca.com/accountstmt.do?value(actions)=acct_stmt'); define('URL_MUTASI_VIEW''https://ibank.klikbca.com/accountstmt.do?value(actions)=acctstmtview'); define('URL_MUTASI_DOWNLOAD''https://ibank.klikbca.com/stmtdownload.do?value(actions)=account_statement');

class 
klikbca_by_semprot {
    var 
$ch false;
    var 
$ip '';
    var 
$last_html '';
    var 
$logged_in false;
    var 
$password '';
    var 
$username '';

    function 
klikbca_by_semprot() {
        
$this->ip $_SERVER['REMOTE_ADDR'];
        
$this->logged_in false;
    }

    
// Argumen pertama = berapa hari yg lalu?
    
function cek_mutasi($minus 30) {
        if (
$this->logged_in == false) {
            
//trigger_error('LOGIN FIRST', E_USER_WARNING);
            //return false;
        
}
        
$minus intval($minus);
        if (
$minus 30) {
            
trigger_error('MAX MINUS IS 30 DAYS'E_USER_WARNING);
            
$minus 30;
        }
        
$now strtotime('Today');
        list(
$day1$month1$year1) = explode(' 'date('d n Y'$now));
        
$minus_t $now - (24 3600 $minus);
        list(
$day2$month2$year2) = explode(' 'date('d n Y'$minus_t));

        
$data = array(
            
//'value(actions)' => 'acctstmtview',
            
'value(D1)' => '0',
            
'value(startDt)' => $day2,
            
'value(startMt)' => $month2,
            
'value(startYr)' => $year2,
            
'value(endDt)' => $day1,
            
'value(endMt)' => $month1,
            
'value(endYr)' => $year1,
            
'value(submit1)' => 'Lihat Mutasi Rekening'
        
);
        
$data http_build_query($data);
        
//echo '<p>', urldecode($data), '</p>';
        
$res $this->my_curl_post(URL_MUTASI_VIEW$dataURL_MUTASI_INDEX);
        
$this->last_html $res['response'];
        return 
true;
    }

    function 
cek_saldo() {
        if (
$this->logged_in == false) {
            
//trigger_error('LOGIN FIRST', E_USER_WARNING);
            //return false;
        
}
        
$res $this->my_curl_get(URL_SALDO);
        
$this->last_html $res['response'];
        
preg_match_all('/color=\"\#0000bb\"\>([ ]+)?([0-9\,]+)/i'$res['response'], $match);
        echo 
'<pre>';print_r($match);echo '</pre>';
        return 
true;
    }

    function 
login() {
        
$this->logged_in false;
        
$data = array(
            
'value(actions)' => 'login',
            
'value(user_id)' => $this->username,
            
'value(user_ip)' => $this->ip,
            
'value(pswd)' => $this->password,
            
'value(Submit)' => 'LOGIN'
        
);
        
$data http_build_query($data);
        
$res $this->my_curl_post(URL_LOGIN$data);
        
$this->last_html $res['response'];
        if (
preg_match('/value\(user_id\)/i'$res['response'])) {
            
trigger_error('CAN NOT LOGIN TO KLIKBCA'E_USER_WARNING);
            return 
false;
        }
        
$this->logged_in true;
        return 
true;
    }

    function 
my_curl_close() {
        if (
$this->ch != false) {
            
curl_close($this->ch);
        }
    }

    function 
my_curl_get($url$ref '') {
        if (
$this->ch == false) {
            
$this->my_curl_open();
        }
        
$ssl false;
        if (
preg_match('/^https/i'$url)) {
            
$ssl true;
        }
        if (
$ssl) {
            
curl_setopt($this->chCURLOPT_SSL_VERIFYPEERfalse);
        }
        if (
$ref == '') {
            
$ref $url;
        }
        
curl_setopt($this->chCURLOPT_URL$url);
        
curl_setopt($this->chCURLOPT_REFERER$ref);
        
$res curl_exec($this->ch);
        
$info curl_getinfo($this->ch);
        return array(
            
'response' => trim($res),
            
'info' => $info
        
);
    }

    function 
my_curl_open() {
        
$this->ch curl_init();
        
curl_setopt($this->chCURLOPT_RETURNTRANSFERtrue);
        
curl_setopt($this->chCURLOPT_AUTOREFERERtrue);
        @
curl_setopt($this->chCURLOPT_FOLLOWLOCATIONtrue);
        
curl_setopt($this->chCURLOPT_MAXREDIRS2);
        
curl_setopt($this->chCURLOPT_COOKIEFILEdirname(__FILE__).'/curl-cookie.txt');
        
curl_setopt($this->chCURLOPT_COOKIEJARdirname(__FILE__).'/curl-cookie.txt');
        
curl_setopt($this->chCURLOPT_USERAGENT$_SERVER['HTTP_USER_AGENT']);
    }

    function 
my_curl_post($url$post_data$ref '') {
        if (
$this->ch == false) {
            
$this->my_curl_open();
        }
        
$ssl false;
        if (
preg_match('/^https/i'$url)) {
            
$ssl true;
        }
        if (
$ssl) {
            
curl_setopt($this->chCURLOPT_SSL_VERIFYPEERfalse);
        }
        if (
$ref == '') {
            
$ref $url;
        }
        
curl_setopt($this->chCURLOPT_URL$url);
        
curl_setopt($this->chCURLOPT_REFERER$ref);
        
curl_setopt($this->chCURLOPT_POST1);
        
curl_setopt($this->chCURLOPT_POSTFIELDS$post_data);
        
$res curl_exec($this->ch);
        
$info curl_getinfo($this->ch);
        return array(
            
'response' => trim($res),
            
'info' => $info
        
);
    }
?>

for main.php:

<?php require_once('klikbca.class.php');define('USERNAME''USERNAME_ANDA_DI_SINI'); define('PASSWORD''PASSWORD_ANDA_DI_SINI');$klikbca = new klikbca_by_semprot(); $klikbca->username USERNAME$klikbca->password PASSWORD$res $klikbca->login();
if (
$res == false) {
    echo 
$klikbca->last_html;
}
/*
$res = $klikbca->cek_saldo();
if ($res != false) {
    echo $klikbca->last_html;
}
*/ 
$res $klikbca->cek_mutasi(10);// 10 hari lalu if ($res != false) {
    echo 
$klikbca->last_html;
$klikbca->my_curl_close();// MUST BE CALLED ?>

3 komentar:

  1. http://www.genuineparts.asia Memberikan Informasi seputar dunia otomatis roda dua. Menjual berbagai macam sparepart yang dibutuhkan

    BalasHapus

Send Your Message

Gallery Produk

10-latest-1110px-slider

Produk Terbaru

WALLPAPER NO BRA, BRA LESS