This is difficult. The best way is to look for the precise headers it always uses (User-Agent, connection timeout, and so on). If the script always comes from that site, of course, you can just block (or redirect) connection attempts from that address. The address can be found with $_SERVER['HTTP_REMOTE_ADDR'], or the domain name with $_SERVER['HTTP_REMOTE_HOST']. To redirect, you use the Location: header like so:
Code:
<?php if($_SERVER['HTTP_REMOTE_HOST'] == "badsite.com") header("Location: http://www.google.com/"); ?>
That may not work, however; it's possible that the script would ignore HTTP redirects. In this case, try:
Code:
<?php if($_SERVER['HTTP_REMOTE_HOST'] == "badsite.com") {
require("http://www.google.com/");
die();
} ?>
If all the above methods fail (the site uses a different address and changes its headers periodically to avoid detection), you'd need to rely on Javascript to tell the bots from the browsers. I'd advise, if it gets to this stage, leaving it; the cost of making your pages dependent on Javascript isn't worth the saving of the bandwidth these bots use up.
Bookmarks