I tried to create an API in PHP, I don't know if it's good, but it works.
I would like to secure the API with a key.
include 'src/callapi.php';
include 'src/variable.php';
$sortie = array('lat' => $lat, 'long' => $long, 'goodtosee' => $goodtosee);
echo json_encode($sortie);
I tried this to secure access:
$key = "blablabla";
if ($_GET["key"] == $key) {
$sortie = array('lat' => $lat, 'long' => $long, 'goodtosee' => $goodtosee);
echo json_encode($sortie);
} else {
echo "key not valid";
}
If the key parameter in the url is equal to "blablabla" then it displays the data otherwise it displays "key not valid
How I can limit the number of calls per month?