How to use the API key
Add the following parameter to the GET request: APPID = APIKEY Example: api.openweathermap.org/data/2.5/forecast/city?APPID= YOURAPIKEY and what you want to request.
<?php $request = 'http://api.openweathermap.org/data/2.5/forecast/city?APPID=***YOURAPIKEY***'; $response = file_get_contents($request); $jsonobj = json_decode($response); print_r($jsonobj); ?>
To request specific information, just look at the keys that the API accepts and adds to the end of the KEY = VAL URL.
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 the API, I recommend installing a plugin to view JSON. I got JSONView installed as Google Chrome extension which is great for json view.
https://chrome.google.com/webstore/search/jsonview?hl=en
source share