Last active
October 28, 2017 07:26
-
-
Save ammarfaizi2/5e59a73db795ea8bdc806575be79bcfe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function scraper() | |
{ | |
$a = explode("<tr class=\"table_header\" align=\"center\">", file_get_contents("https://www.jadwalsholat.org/adzan/monthly.php?id=193")); | |
$a = explode("<tr class=\"table_block_title\">", $a[1]); | |
$a = explode("align=\"center\">", $a[0]); unset($a[0]); | |
foreach ($a as $key => $val) { | |
$b = explode("<td><b>", $val, 2); | |
$b = explode("</b>", $b[1], 2); | |
$c = explode("</td>", $b[1], 2); | |
$c = explode("</tr>", $c[1], 2); | |
$c = explode("<td>", $c[0]) xor $f = function($x){return html_entity_decode(strip_tags($x), ENT_QUOTES, 'UTF-8');}; | |
isset($c[8]) and $r[(int)$b[0]] = [ | |
"Imsyak" => $f($c[1]), | |
"Shubuh" => $f($c[2]), | |
"Terbit" => $f($c[3]), | |
"Dhuha" => $f($c[4]), | |
"Dzuhur" => $f($c[5]), | |
"Ashr" => $f($c[6]), | |
"Maghrib"=> $f($c[7]), | |
"Isya" => $f($c[8]) | |
]; | |
} | |
return $r; | |
} | |
$data = scraper(); | |
echo "<table border=\"1\"><tr><td>No.</td>"; | |
array_walk($data[1], function($a,$i) { echo "<td>".$i."</td>";}); | |
echo "</tr>"; | |
foreach ($data as $key => $val) { | |
echo "<tr><td>".$key."</td>"; | |
foreach ($val as $val) { | |
echo "<td>".$val."</td>"; | |
} | |
echo "</tr>"; | |
} | |
echo "</table>"; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment