I'm using PHP and json to make an API and I would like to limit the access for it. The most user-friendly way to do this (in my opinion), would be an APIKey for each user. What I'd like to do is check who's using/requesting the json, and then I could check the site toward the key (I know how to do the last part). (The key will be appended to site url ?key=KEY)
I have tried
$_SERVER['HTTP_REFERER'];
But apparently this would only show the last site if you're redirected to my site.
I hope this wasn't TOO subjective, and I don't really know how to explain this in any other ways. Hopefully someone could understand what I'm trying to do and maybe got a better solution? I'm kinda new to making API's atleast limited ones. Thanks!