This API is now deprecated and is no longer updated nor maintained, use this API at your own risk of it breaking.
If you are wanting to have a COVID-19 data page, this API will certainly help. To start off, you need to add this PHP code.
Copy <?php
$contents = file_get_contents("https://api.tylermwise.uk/v2/covid19");
$data = json_decode($contents);
?>
Now to get the chosen bit of data you can use any of these bits of code:
Copy <?php
echo $data->credit;
echo $data->world_confirmed;
echo $data->world_deaths;
echo $data->world_recovered;
echo $data->uk_deaths;
echo $data->uk_total_cases;
echo $data->uk_daily_confirmed;
echo $data->uk_daily_tested;
echo $data->uk_critical_cases;
echo $data->uk_active_cases;
echo $data->uk_total_tested;
echo $data->uk_total_vaccinations;
echo $data->uk_daily_vaccinations;
?>
GET
https://api.tylermwise.uk/v2/covid19
200: OK
Copy {
"credit": "API Data from tylermwise.com",
"world_confirmed": "000,000,000,000",
"world_deaths": "0,000,000,000",
"world_recovered": "0,000,000,000",
"uk_deaths": "000,000,000",
"uk_total_cases": "00,00,000,000",
"uk_daily_confirmed": "00,000,000",
"uk_daily_tested": "000,000,000",
"uk_critical_cases": "000,000",
"uk_active_cases": "000,000,000",
"uk_total_tested": "000,000,000,000",
"uk_total_vaccinations": "000,000",
"uk_daily_vaccinations": "0000,000",
"updated": "00:00:00, 00/00/0000"
}
Covid-19 World Data Stats
If you are wanting to get the COVID-19 data from around the world, you can do it the same as the UK Data, just with other tags:
Copy <?php
echo $data->world_confirmed;
echo $data->world_deaths;
echo $data->daily_confirmed;
?>
Covid-19 Testing Stats
If you would like to get information, such as how many people are tested, you can do this code:
Copy <?php
echo $data->uk_daily_tested;
?>
Covid-19 Vaccinations
The code below shows you how you can get your UK Total Vaccinations, but also the UK daily vaccinations:
Copy <?php
echo $data->uk_total_vaccinations;
echo $data->uk_daily_vaccinations;
?>
Covid-19 Stats
This code shows you the total UK cases, the daily confirmed cases, but also the critical Covid-19 cases in the UK.
Copy <?php
echo $data->uk_total_cases;
echo $data->uk_daily_confirmed;
echo $data->uk_critical_cases;
?>
API Credit
This is optional, but we want to give this API to everyone, so we would really like it if you used this bit of code, as it tells users where the data came from:
Copy <?php echo $data->credit; ?>