skrinsut:
<?php
function bacaHTML($url){
// inisialisasi CURL
$data = curl_init();
// setting CURL
curl_setopt($data, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($data, CURLOPT_URL, $url);
// menjalankan CURL untuk membaca isi file
$hasil = curl_exec($data);
curl_close($data);
return $hasil;
}
$kodeHtml = bacaHTML('http://www.bankmandiri.co.id/resource/kurs.asp');
$pecah = explode('<table class="tbl-view" border="0" cellpadding="0" cellspacing="0" width="100%">', $kodeHtml);
$pecahLagi =explode('</p>', $pecah[1]);
echo "<div align='center'> <table>";
echo $pecahLagi[0];
echo "</table></div>";
?>
http://blog.rosihanari.net/teknik-grabbing-mengambil-teks-dari-situs-lain-dengan-curl
0 comments:
Post a Comment