Covid-19 API (V1)

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.

<?php
    $contents = file_get_contents("https://api.tylermwise.uk/v1/covidstats");
    $data = json_decode($contents);
?>

Now to get the chosen bit of data you can use any of these bits of code:

<?php
    echo $data->credit;
    echo $data->daily_tested;
    echo $data->tested;
    echo $data->daily_confirmed;
    echo $data->infected;
    echo $data->deceased;
    echo $data->deceased;
    echo $data->world_confirmed;
    echo $data->world_deaths;
    echo $data->world_recovered;
    echo $data->about;
    echo $data->symptoms;
    echo $data->self_isolation;
    echo $data->treatments_overview;
    echo $data->self_care;
    echo $data->other_treatments;
    echo $data->prevention;
?>

If you want to read what they current are, you can find the JSON names and what's in them here api.tylermwise.com/v1/covidstats

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:

<?php
    echo $data->world_confirmed;
    echo $data->world_deaths;
    echo $data->world_recovered;
?>

Covid-19 Information Stats

Instead of the scary numbers, you can get advice on how to stay safe:

<?php
    echo $data->about;
    echo $data->symptoms;
    echo $data->self_isolation;
    echo $data->treatments_overview;
    echo $data->self_care;
    echo $data->other_treatments;
    echo $data->prevention;
?>

Covid-19 Testing Stats

If you would like to get information, such as how many people are tested, you can do this code:

<?php
    echo $data->daily_tested;
    echo $data->tested;
    echo $data->daily_confirmed;
    echo $data->infected;
    echo $data->deceased;
    echo $data->deceased;
?>

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:

<?php echo $data->credit; ?>

Last updated