Created
January 30, 2020 22:47
-
-
Save daniel-dona/56c9f00a7377e1807d0642bc9597a5f3 to your computer and use it in GitHub Desktop.
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 | |
//Data from Johns Hopkins CSSE | |
$q = '[{"statisticType":"sum","onStatisticField":"Confirmed","outStatisticFieldName":"confirmed"}, {"statisticType":"sum","onStatisticField":"Deaths","outStatisticFieldName":"dead"}, {"statisticType":"sum","onStatisticField":"Recovered","outStatisticFieldName":"recovered"}]'; | |
$endpoint = "https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/". | |
"ncov_cases/FeatureServer/1/query?f=json&where=1%3D1&returnGeometry=false". | |
"&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics="; | |
$json = json_decode(file_get_contents($endpoint.urlencode($q)), true); | |
$data = array(); | |
$data["confirmed"] = $json["features"][0]["attributes"]["confirmed"]; | |
$data["recovered"] = $json["features"][0]["attributes"]["recovered"]; | |
$data["dead"] = $json["features"][0]["attributes"]["dead"]; | |
$output = json_encode($data); | |
echo $output; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment