Posting kali ini masih tentang php cURL. Yakni tentang cek tagihan PLN. sebenr nya bisa langsung ke web PLN. klik'. tapi kita cek via cur. tentunya bisa kita manfaatkan untuk kebutuhan program kita. berikut kodenya :
demikian semoga bermanfaat ..
<?
/*
Author : Ali Muntaha
Website : http://sinausantai.com
Email : alimuntaha@gmail.com
Created : 06 Agustus 2011
*/
$idpel = "513130351821";
$param = "idpel=".$idpel."&action=login&button=Login";
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiesjar);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiesjar);
curl_setopt($ch, CURLOPT_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($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$param);
curl_setopt($ch, CURLOPT_URL, "http://202.162.217.251/info-billing2011/index.php?mod=login");
$info = curl_exec($ch);
//echo $info;
curl_setopt($ch, CURLOPT_URL, "http://202.162.217.251/info-billing2011/index.php?idpel=513130351821&mod=tagihan.bulan&action=search&fst=on");
curl_setopt($ch, CURLOPT_REFERER, "http://202.162.217.251/info-billing2011/index.php?mod=login");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
$info = curl_exec($ch);
//echo $info;
curl_close($ch);
preg_match("/<span class=\"textspan_16_bold_blue\">(.*)<\/span><\/span><br\/><br\/>/U", $info, $tagihan);
preg_match("/<span class=\"textspan_16_bold_red\">(.*) :/U", $info, $bulan);
preg_match("/<td valign=\"middle\"><b><input type=\"text\" value=\"(.*)\" size=50 c/U", $info, $nama);
preg_match("/<td valign=\"middle\"><b><input type=\"text\" value=\"(.*)\" size=20/U", $info, $rekening);
preg_match("/<td valign=\"middle\"><b><input type=\"text\" value=\"(.*)\" size=70/U", $info, $alamat);
echo "<br>No Rek : ".$rekening[1];
echo "<br>Nama : ".$nama[1];
echo "<br>Alamat : ".$alamat[1];
echo "<br>".$bulan[1]. " : ". $tagihan[1];
?>
demikian semoga bermanfaat ..




20.22
Ali Muntaha
Posted in: 


