PHP code example of fa / weather

1. Go to this page and download the library: Download fa/weather library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fa / weather example snippets


use Overtrue\Weather\Weather;
$key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';
$weather = new Weather($key);

{
 "status": "1",
 "count": "1",
 "info": "OK",
 "infocode": "10000",
 "lives": [
     {
         "province": "广东",
         "city": "深圳市",
         "adcode": "440300",
         "weather": "中雨",
         "temperature": "27",
         "winddirection": "西南",
         "windpower": "5",
         "humidity": "94",
         "reporttime": "2018-08-21 16:00:00"
     }
 ]
}
$xslt
$response = $weather->getWeather('深圳');