Snippet for open proxy blocking

Hey there, gals and guys, here’s the deal:

I’m trying to integrate a layer of open proxy blocking in my website. I found out a pretty nifty tool for that - . What I want to do is, create a PHP snippet that would be inserted in the header section of each one of my HTMLs/PHPs. The snippet would have to extract the REMOTE_ADDR from the request to it, and substitute it in:

Then do a query at that URL, and, according to the single character returned as an answer, define two separate possible actions:

  1. Y ( originating IP is identified as a proxy server ): deny access to the resource

  2. N or X ( originating IP is not a proxy server, found in the database ): load resource as usual

Any idea on how to do that?

I will be adding another snippet to make sure that no regular proxy headers are allowed too, but the example above would be really useful for me to deny access to a wide array of open proxies, that could be classified as anonymous.

You can use cURL

Sponsor our Newsletter | Privacy Policy | Terms of Service