Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $d = json_decode(file_get_contents('https://petition.parliament.uk/petitions/131215.json'),true);
- printf('Last update: %s'.PHP_EOL,$d['data']['attributes']['updated_at']);
- foreach(['signatures_by_country','signatures_by_constituency'] as $type){
- $n = 0;
- foreach($d['data']['attributes'][$type] as $k => $v){
- $n += $v['signature_count'];
- }
- printf('%s: %d'.PHP_EOL,$type,$n);
- }
- unset($type,$n,$d,$k,$v);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement