include('simple_html_dom.php');
set_time_limit(0);
$start = $_REQUEST['start'];
$end = $_REQUEST['end'];
if($_REQUEST['start'] != '') {
echo "<table border='1'>";
echo "<tr><td>Nomor Peserta</td><td>Nama</td><td>Hasil</td></tr>";
for($n=$start; $n<=$end; $n++) {
$url = 'http://um1.ugm.ac.id/index.php?pModule=pengumuman_lulus&pSub=pengumuman_lulus&pAct=view&jlr=utul';
$data = 'kata_kunci='.$n.'&lihat_lokasi_ujian=Cari';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$Rec_Data = curl_exec($ch);
$html = str_get_html($Rec_Data);
echo "<tr>";
foreach($html->find('table') as $e) {
echo "<td>" . $e->find('td', 2)->plaintext . "</td>";
$lulus = $e->find('td', 9)->plaintext;
$pos = strpos($lulus, "Maaf,");
if($pos === false) {
echo "<td>" . ucwords(strtolower($e->find('td', 11)->plaintext)) . "</td>";
echo "<td>";
echo ucwords(strtolower($e->find('td', 18)->plaintext)) . " - " . ucwords(strtolower($e->find('td', 15)->plaintext));
echo "</td>";
}
else {
echo "<td>" . ucwords(strtolower($e->find('td', 8)->plaintext)) . "</td>";
echo "<td>Coba Lagi :)</td>";
}
}
echo "</tr>";
}
echo "</table>";
}
Senin, 20 Desember 2010
Grab data using PHP, cURL, and HTML DOM Manipulation
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar