API Multiple URLs in PHP
Let's now create an API that will have several URLs for access. For example, let's assume the following set of addresses is available:
http://api.loc/hour.php
http://api.loc/min.php
http://api.loc/sec.php
Accessing the first address should return the current hour:
<?php
echo date('H');
?>
Accessing the second address returns the current minutes:
<?php
echo date('i');
?>
Accessing the third address returns the current seconds:
<?php
echo date('s');
?>
Create an API with three URLs. Accessing the first one should return the current day, the second one - the current month, the third one - the current year.