Advertisement
shutdown57

Jadwal Sholat :'v

Jun 23rd, 2018
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.39 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>- jadwal sholat -</title>
  5. </head>
  6. <body><script>
  7.     // coded by : shutdown57
  8.     // JavCode - ZeroByte.ID
  9. function sholatGan()
  10. {
  11.  
  12.     var mek = document.getElementById('kota').value;
  13.     history.pushState(null,null,'?kota='+mek);
  14.     var xhttp = new XMLHttpRequest();
  15.     xhttp.onreadystatechange = function() {
  16.     if (this.readyState == 4 && this.status == 200) {
  17.       document.getElementById("show_me").innerHTML = this.responseText;
  18.     }
  19.   };
  20.   xhttp.open('GET','?kota='+mek,true);
  21.   xhttp.send();
  22. }
  23. </script>
  24.     <style type="text/css">html,body{background:#333;color: #0f0;}input{color: #eee;border: 1px solid #0f0;padding: 6px;background: transparent;}.content{width:60%;margin: 0 auto;;padding: 10px}</style>
  25.  
  26.     <center><h3>Jadwal Sholat</h3> </center>
  27. <?php
  28. function getJadwal($kota,$token)
  29. {
  30.     $c = curl_init();
  31.     $setup = curl_setopt_array($c,array(
  32.         CURLOPT_URL => "http://muslimsalat.com/".$kota.".json?key=".$token,
  33.         CURLOPT_USERAGENT => "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0",
  34.         CURLOPT_RETURNTRANSFER=>true,
  35.         ));
  36.     return curl_exec($c);
  37.     curl_close($c);
  38. }
  39.  
  40. if(!empty($_GET['kota']))
  41. {
  42.  
  43. $result = getJadwal($_GET['kota'],"bd099c5825cbedb9aa934e255a81a5fc");
  44. /*$result = @file_put_contents('data.temp',$result);*/
  45.  
  46. if(!preg_match("/location and try again/",$result))
  47. {
  48. /*$djson = json_decode(file_get_contents('data.temp'));
  49. */
  50. $djson = json_decode($result);
  51. echo "<h3> Hasil pencarian dari kota <i>".$djson->query."</i></h3><br>";
  52. //print_r($djson);
  53. echo "[+] Daerah   : ".$djson->title."<br>";
  54. echo "[+] Tanggal  : ".$djson->items[0]->date_for."<br>";
  55. echo "===================================================<br>";
  56. echo "[+] Shubuh   : ".$djson->items[0]->fajr."<br>";
  57. echo "[+] Dhuhur   : ".$djson->items[0]->dhuhr."<br>";
  58. echo "[+] Ashar    : ".$djson->items[0]->asr."<br>";
  59. echo "[+] Maghrib  : ".$djson->items[0]->maghrib."<br>";
  60. echo "[+] Isya'    : ".$djson->items[0]->isha."<br>";
  61. echo "===================================================<br>";
  62. echo "<img src='".$djson->map_image."'>";
  63. }
  64.  
  65. }else{
  66.     ?><div class="content"><center><input type="text" name="kota" placeholder="Input kota, ex : jepara,semarang etc." value="" style="width: 300px" id="kota"><input type="button" value=">>" onclick="sholatGan();"></center></div><?php
  67. }
  68.  
  69. ?>
  70. <div id="show_me" class="content"></div>
  71.  
  72. </body>
  73. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement