Get Weather - Step 3 - Class


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. class WeatherService{
  2.  
  3. public function WeatherService(){
  4. //some initialization...
  5. }
  6.  
  7. public function getWeatherInfo($city){
  8.  
  9. $res = shell_exec("./getWdr.sh {$city}");
  10.  
  11. return $res;
  12. }
  13.  
  14. public function convertFrToC($val){
  15. return (($val+40)*5/9)-40;
  16. }
  17.  
  18. }
  19.  
  20.  
  21. $obj = new WeatherService;
  22. $obj->getWeatherInfo("haifa");

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.