Topic: Cara memanggil atau mengambil content halaman suatu web
Berikut adalah cara untuk memanggil atau mengambil content halaman suatu web dengan menggunakan fungsi PHP
function manggilHalamanWeb($url) {
$crl = curl_init();
$timeout = 1000;
set_time_limit(6000);
curl_setopt ($crl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($crl, CURLOPT_URL, $url);
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt ($crl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt ($crl, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt ($crl, CURLOPT_COOKIEFILE, "/");
curl_setopt ($crl, CURLOPT_COOKIEJAR, "/");
$ret = curl_exec($crl);
curl_close($crl);
return $ret;
}
$html = crawlWebPage("http://developerindonesia.com");