I have an RSS feed, users will be using it to rip content to display on there site. However I need todo a check that the site doing so has access.
Its just occurred to me that I have no idea in PHP how to detect if the script is being read by a server and what the URL is of the fetch.
Is it possible?
The best approaches for this are...
It is possible to tell the IP address of the fetching server using $_SERVER["REMOTE_ADDR"]
. Whether anything else is possible to tell depends on the methods your users use to "rip" the feed.
Strictly speaking it is not, unless the server/client goes to lengths to identify themselves (HTTP authentication, custom header, data provided in a POST request, etc.).
$_SERVER["REMOTE_ADDR"]
gives you the IP of the requesting server. By checking this you could implement a basic access control check.