Advertisement
Guest User

weather

a guest
Jul 29th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1. <?php
  2.    
  3.     $temp_data_user = file_get_contents('http://ipinfo.io/'.$_SERVER['REMOTE_ADDR'].'/json');
  4.     $data_user = json_decode($temp_data_user,true);
  5.    
  6.     $cords = explode(',',$data_user['loc']);
  7.    
  8.     $temp_data_weather = file_get_contents('http://api.openweathermap.org/data/2.5/weather?units=metric&lat='.$cords[0].'&lon='.$cords[1]);
  9.     $data_weather = json_decode($temp_data_weather,true);
  10.  
  11.     print_r($data_weather);
  12. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement