I have openweathermap api key , but how can I use it in PHP ? and the weather report should be report from a city name, not from the location weather ID
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
How to use API key
Add the following parameter to the GET request: APPID=APIKEY Example: api.openweathermap.org/data/2.5/forecast/city?APPID=YOURAPIKEY & what ever you want to request.
To request specific information just look at the keys that the API accepts and append & to the end of the url KEY=VAL.
An example would be
http://api.openweathermap.org/data/2.5/weather?APPID=YourAPIKey&q=London
I would also like to add when working with API's I recommend installing a JSON viewer plugin. I got the JSONView installed as a Google chrome extension which is brilliant for viewing json.
https://chrome.google.com/webstore/search/jsonview?hl=en