Building a simple proxy checker tool

In case you’re trying to change the configuration of your proxy server you might want to check what appears in the logs of a web server returning data to your proxy. Maybe you want to suppress certain HTTP header fields or make sure that the browser’s user agent is forged correctly.

This post discusses a PHP script which tries to display helpful information from the web server’s perspective. Although it may not be complete you can easily extend it to suit your needs.

The tool

All we need to do is to upload this script to a web server and access it through our proxy. The output shows us the information a web server may store in his log files, i.e. things like our IP address, the referrer, the browser’s user agent and proxy related fields like Via or Forwarded-For.

The code needed to implement this in PHP is pretty easy: just have a look at $_SERVER and you’ll find a lot of interesting information. In case you’re missing something have a look at PHP’s predefined variables. Maybe you want to play around with cookies, check out $_COOKIE if you would like to display information about cookies.

Why do we need another proxy checker, there are plenty of websites doing this kind of stuff, you may ask. I think that depends on two factors: speed and reliability. Obviously, uploading the script to your web server at home and sending requests to this machine will be a lot faster than any web server on the internet. Second, you need reliable information, i.e. again it’s easier to trust your own web server and PHP script than some site on the net.

Conclusion

Using PHP it’s easy to bootstrap your own proxy checker tool. Although the script presented in this posts is really simple, it helps us to get the relevant information quick. Repeatedly requesting the script and tweaking the configuration of your proxy should help you to get the desired results.