Random Fact API
Before you can make the random fact appear, you first need to add the following line of code:
<?php
$contents = file_get_contents("https://api.tylermwise.uk/v1/randomfact");
$data = json_decode($contents);
?>
Now you have added that, you can add either the random fact or the credit code!
<?php
echo $data->credit;
echo $data->fact;
?>
GET
https://api.tylermwise.uk/v1/randomfact
{
"credit": "API Data from <a href='https://dev.tylermwise.com/randomfact'>tylermwise.com</a>",
"fact": "A random fact will appear here!"
}
Random Fact
The following line of code gets the random fact:
<?php echo $data->fact; ?>
API Credit
If you want to support me, please add this line somewhere on your website as it supports me and the API:
<?php echo $data->credit; ?>
Last updated