Skip to content

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: https://mazitekgh.com/covid19/v1/

License

Notifications You must be signed in to change notification settings

zakaria16/covid19Data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

How to use the source code

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);

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 https://mazitekgh.com/covid19/v2/

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 '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'

errors:

country not found error:

{
    "error": "location not found"
}

version 1

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"
    }
}

Use case

Timeline and statistics of Corona cases in Ghana Ghana COVID data statistics:

statistics source: wikipedia

About

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: https://mazitekgh.com/covid19/v1/

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages