Developers get a constantly updated data in JSON format on COVID-19 cases (including confirmed cases, death cases and recorvered cases ) both local(Ghana) and global data with this endpoint:
mazitekgh.com
# covid19Data
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
mazitekgh.com
- version 2
mazitekgh.com
## How to use the source code
To retrieve COVID19 cases for county Ghana.
```php
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);
```
### methods
`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
## version 2
The version two provides statistics for many countries.
endpoint: `GET`
mazitekgh.com
#### parameters:
|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
#### Example:
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 '
mazitekgh.com'
```
Result:
```json
{
"country": "burkina faso",
"existing": 100,
"confirmed": 641,
"recovered": 498,
"deaths": 43,
"date": "30th April, 2020",
"time": "18:16"
}
```
for **Togo:** `curl --location --request GET '
mazitekgh.com'`
for **United Kingdom:** `curl --location --request GET '
mazitekgh.com'`
or `curl --location --request GET '
mazitekgh …