kurs bank indonesia

Script untuk mengambil kurs dolar dari Bank Indonesia

// file bi.php
function fungsiCurl($url){
     $data = curl_init();
     curl_setopt($data, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($data, CURLOPT_URL, $url);
	 curl_setopt($data, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv: Gecko/20070725 Firefox/");
     $hasil = curl_exec($data);
     return $hasil;
$url = fungsiCurl('http://www.bi.go.id/web/id/Moneter/Kurs+Bank+Indonesia/Kurs+Transaksi/');
$pecah = explode('<td valign="top" align="center"><font size="-1" face="verdana,arial" ><b>Graph</b></font></td>', $url);
$pecah2 = explode ("",$pecah[1]);
echo "<table border='1'>";
print_r ($pecah2[21]);	
print_r ($pecah2[6]);	
echo "</table>";

Join the Conversation

1 Comment

Your email address will not be published. Required fields are marked *