Personally, I'd use a PHP HTTP router instead. Link all requests to something like index.php?uri=$1. That's how most frameworks do it. A lot less rewriting. And then they just pass $_GET['uri'] around.
And if the URI is /api/users/1 get the user by the ID of 1. Pretty simple.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Personally, I'd use a PHP HTTP router instead. Link all requests to something like
index.php?uri=$1
. That's how most frameworks do it. A lot less rewriting. And then they just pass$_GET['uri']
around.And if the URI is
/api/users/1
get the user by the ID of 1. Pretty simple.