Covid-19 API
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.
1
<?php
2
$contents = file_get_contents("https://api.tylermwise.com/covidstats");
3
$data = json_decode($contents);
4
?>
Copied!
Now to get the chosen bit of data you can use any of these bits of code:
1
<?php echo $data->daily_tested; ?>
2
<?php echo $data->tested; ?>
3
<?php echo $data->daily_confirmed; ?>
4
<?php echo $data->infected; ?>
5
<?php echo $data->deceased; ?>
6
<?php echo $data->deceased; ?>
Copied!
Each one echo's a different piece of the JSON code. If you want to read what ones there are, you can find the JSON names and what's in them here api.tylermwise.com/covidstat

Covid World Data API

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:
1
<?php
2
$contents = file_get_contents("https://api.tylermwise.com/covidstats");
3
$data = json_decode($contents);
4
?>
Copied!
This is how you get the world data:
1
<?php echo $data->world_confirmed; ?>
2
<?php echo $data->world_deaths; ?>
3
<?php echo $data->world_recovered; ?>
Copied!

Covid-19 Information API

Instead of the scary numbers, you can get advice on how to stay safe:
1
<?php
2
$contents = file_get_contents("https://api.tylermwise.com/covidstats");
3
$data = json_decode($contents);
4
?>
Copied!
This is the Information data code
1
<?php echo $data->about; ?>
2
<?php echo $data->symptoms; ?>
3
<?php echo $data->self_isolation; ?>
4
<?php echo $data->treatments_overview; ?>
5
<?php echo $data->self_care; ?>
6
<?php echo $data->other_treatments; ?>
7
<?php echo $data->prevention; ?>
Copied!

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:
1
<?php echo $data->credit; ?>
Copied!
Last modified 3mo ago