Developers get a constantly updated data in JSON format on COVID-19 cases (including confirmed cases, death cases and recovered cases ) both local(Ghana) and global data with this endpoint:
- version 1 https://mazitekgh.com/covid19/v1/
- version 2 https://mazitekgh.com/covid19/v2/
To retrieve COVID19 cases for county Ghana.
require_once 'Covid19Data.php';
//create an instance
$covid_data = new Covid19Data();
$ghana_data = $covid_data->retrieve_covid_data_wiki('ghana');
echo json_encode($ghana_data);
retrive_covid_data_wiki($loc)
scrape the data from wikipedia
retrieve_covid_data_worldometers($loc)
scrape the data from worldometer
it seems they dont allow scrapping kindly read their terms and condition before you use theirs.
See example.php
for more info on how to use them.
You can also use the API's below to get the data
The version two provides statistics for many countries.
endpoint: GET
https://mazitekgh.com/covid19/v2/
param | description |
---|---|
loc | the country you want to retrieve its data |
if no parameter is provided it will return the same output as Version 1
To get the stats for a particular country just send a GET
request to the v2 endpoint with parameter ?loc=country_name
if the country name contains spaces you can replace the space with and underscore(_).
For example say to retrieve stats for a country say Burkina Faso:
curl --location --request GET 'https://mazitekgh.com/covid19/v2?loc=burkina_faso'
Result:
{
"country": "burkina faso",
"existing": 100,
"confirmed": 641,
"recovered": 498,
"deaths": 43,
"date": "30th April, 2020",
"time": "18:16"
}
for Togo: curl --location --request GET 'https://mazitekgh.com/covid19/v2?loc=togo'
for United Kingdom: curl --location --request GET 'https://mazitekgh.com/covid19/v2?loc=uk'
or curl --location --request GET 'https://mazitekgh.com/covid19/v2?loc=united_kingdom'
country not found error:
{
"error": "location not found"
}
Developers get a constantly updated data in JSON format on COVID-19 cases (including confirmed cases, death cases and recovered cases ) both local(Ghana) and global data with this endpoint: version 1 endpoint https://mazitekgh.com/covid19/v1/
The output format is of the form below:
{
"ghana": {
"existing": "50",
"confirmed": "52",
"recovered": "",
"deaths": "2",
"date": "24th March, 2020",
"time": "18:26"
},
"global": {
"existing": "285,081",
"confirmed": "410,465",
"recovered": "107,089",
"deaths": "18,295",
"date": "24th March, 2020",
"time": "18:26"
}
}
Timeline and statistics of Corona cases in Ghana Ghana COVID data statistics:
statistics source: wikipedia