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.  ----------------------------------- */
  7. // Get the page
  8. $value = strip_tags(file_get_contents('http://www.e-solat.gov.my/solat.php?kod=sgr01&lang=BM'));
  9.  
  10. // Remove unwanted strings & values, cleaning html tags and spaces
  11. $stripped_value = preg_replace('/\s+/','',$value);
  12. $waktu = explode('WaktuSolat', str_replace('&nbsp;', ' ', $stripped_value));
  13. $waktu1 = ereg_replace("[^0-9: ]", "", $waktu[1]);
  14. $solat = explode(' ', str_replace(' ',' ', $waktu1));
  15.  
  16. // Print out prayer time
  17. echo "Subuh: ".@date('g:ia', @strtotime($solat[2]))."\t\tZuhur: ".@date('g:ia', @strtotime($solat[4])).
  18. "\t\tAsar: ".@date('g:ia', @strtotime($solat[5]))."\nMaghrib: ".@date('g:ia', @strtotime($solat[6]))."\t\tIsyak: ".@date('g:ia', @strtotime($solat[7]));
  19.  
  20. ?>

Report this snippet  

You need to login to post a comment.