Mengambil Data website lain, dengan technik grabbing
Grabbing.php
<?php
function grabbing($url){
$grab = curl_init();
curl_setopt($grab, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($grab, CURLOPT_URL, $url);
$get = curl_exec($grab);
curl_close($grab);
return $get;
}
$hasil = grabbing('http://situs.com');
$situs = explode('<b>', $hasil);
$situs2 = explode('</b>', $situs[1]);
echo $situs2[1];
?>
Example
Grabbing www.gudangpuisi.com.
Grabbing.php
<?php
function grabbing($url){
$get = curl_init();
curl_setopt($get, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($get, CURLOPT_URL, $url);
$finish = curl_exec($get);
curl_close($get);
return $finish;
}
$grab = grabbing('http://www.gudangpuisi.com/');
$html = explode('<div id="content" class="grid_10">', $grab); // batas awal potongan html
$html2 = explode('<div id="myController">', $html[1]); // batas akhir potongan html
echo "<table align='center' width='700' border='1'><tr><td>";
echo "$html2[0]";
echo "</td></tr></table>";
?>