Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //source from http://stackoverflow.com/questions/4035742/parse-json-in-php
- //updated api url and minor code tweaks
- $json = json_decode(file_get_contents("http://free.worldweatheronline.com/feed/weather.ashx?q=98105&format=json&num_of_days=5&key=8f2d1ea151085304102710"), true);
- foreach($json['data']['weather'] as $item) {
- print $item['date'];
- print ' - ';
- print $item['weatherDesc'][0]['value'];
- print ' - ';
- print '<img src="' . $item['weatherIconUrl'][0]['value'] . '" border="0" alt="" />';
- print '<br>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment