Skip to content

TylerMWise/Covid-19-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Covid UK Data API

If you are wanting to have a Covid 19 data page, thise API will certainly help. Too start off you need to add this PHP code

<?php
$contents = file_get_contents("https://api.tylermwise.com/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->daily_tested; ?>
<?php echo $data->tested; ?>
<?php echo $data->daily_confirmed; ?>
<?php echo $data->infected; ?>
<?php echo $data->deceased; ?>
<?php echo $data->deceased; ?>

Each one echos a different piece of the JSON code. If you want to read what ones there are you can find the JSON names and whats 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:

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

This is how you get the world data:

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

Covid information API

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

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

This is the Information data code:

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

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;

About

Free easy to use PHP JSON API!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages