Posted By

fazlee on 11/17/11


Tagged

time prayer solat e-solat


Versions (?)

e-solat php script


 / Published in: PHP
 

The purpose of this code is to grab information from e-solat.gov.my and get payer exact time. I use this code with GeekTools.

  1. <?php
  2. /* --------------------------------------------
  3. Malaysia Prayer time for GeekTools
  4. Data source : http://www.e-solat.com.my
  5. Author : Fazlee Rezuan [[email protected]]
  6. version : 1.1
  7.  ----------------------------------- */
  8. // Get the page
  9. $value = strip_tags(file_get_contents('http://www2.e-solat.gov.my/solat.php?kod=sgr01&lang=BM'));
  10.  
  11. // Remove unwanted strings & values, cleaning html tags and spaces
  12. //$stripped_value = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $value);
  13. $stripped_value = preg_replace('/\s+/',' ',$value);
  14. $waktu = explode('WaktuSolat', str_replace('&nbsp;', ' ', $stripped_value));
  15. $waktu1 = ereg_replace("[^0-9: ]", "", $waktu[1]);
  16. $solat = explode(' ', str_replace(' ',' ', $waktu1));
  17. $strip_waktu = explode(" ", $waktu[0]);
  18.  
  19. // Print out prayer time
  20. echo "Subuh:".@date('g:ia', @strtotime($strip_waktu[6]))."\tZuhur:".@date('g:ia', @strtotime($strip_waktu[10])).
  21. "\tAsar:".@date('g:ia', @strtotime($strip_waktu[12]))."\tMaghrib:".@date('g:ia', @strtotime($strip_waktu[14]))."\tIsyak:".@date('g:ia', @strtotime($strip_waktu[16]));
  22. ?>

Report this snippet  

You need to login to post a comment.