Last active
June 25, 2016 19:08
-
-
Save Committing/06c88b38a192968d96a23446988eda93 to your computer and use it in GitHub Desktop.
Order parliament.uk votes by country
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$res = file_get_contents('https://petition.parliament.uk/petitions/131215.json'); | |
$select = json_decode($res); | |
$output = array(); | |
$count = 0; | |
foreach ($select->data->attributes->signatures_by_country as $var) { | |
$output[$var->name] = $var->signature_count; | |
$count = $count + $var->signature_count; | |
} | |
arsort($output); | |
echo 'Total votes: ' . number_format($count) . '<br /><br />'; | |
echo '<pre>'; | |
print_r($output); | |
echo '</pre>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment