<!DOCTYPE html>
<head>
<title>Belajar cara memasukkan kode PHP</title>
</head>
<body>
<?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;
}
$isine = bacaHTML('http://www.mahesajenar.com/scripts/ayat.php');
$bersih= explode('<b>', $isine);
$bersih= str_replace("document.write(", "", $bersih);
$bersih= str_replace("widget lain", "", $bersih);
$bersih= str_replace("<br/><br/><a href='http://widgets.mahesajenar.com/'></a>", "", $bersih);
$bersih= str_replace("</strong>", "", $bersih);
$bersih= str_replace("<br /><strong>", "", $bersih);
$bersih= str_replace(");", "", $bersih);
echo "$bersih[0]";
?>