How Can I Write An Anonymyzing Proxy In PHP?
September 12, 2007 8:57 PM
Subscribe
I would like to make an anonymous proxy using PHP (similar in concept to how http://anonymouse.org works). The difference between my project and Anonymouse is that my project is intended for private group use on a specific group of sites (note that this does not break the TOS of either my awesome webhost or the sites on which I'll be using the proxy).
The proxy needs to be able to do a few things. First and foremost, it needs to be able to retrieve a URL of my choice and store Cookies. I have a fairly good idea how to do that.
The part I'm having trouble with is URL rewriting (so, for example, <a href="http://www.google.ca"> will be rewritten so it links to http://www.myproxy.com/?link=http://www.google.ca instead of directly to google), and also, Javascript stripping (one of the reasons I'm creating this is so my friends can access the site while on a locked down computer - they can't disable Javascript, and Javascript can be cleverly written to avoid URL rewriting).
Is there any feasible way to ensure that the proxy remains truly anonymous? I've come up with two solutions so far:
1) Somehow strip all Javascript from the document, as well as intercept all incoming URLs and rewrite them. I know how to do this on a basic level, but I'm sure there are cases I'm missing. Any suggestions?
(I am aware of the php proxy Poxy - but it says that its Javascript stripping is imperfect)
2) Since I know the sites that this will be used on, I could potentially write the proxy such that it acts as a screen scraper, getting all the useful info from the site itself, and writing it out in html-escaped form, using its own formatting. However, I'm worried about what might happen if the sites change layout suddenly. Is there a way to scrape html effectively so that it's not as sensitive to layout change?
3) Open to any other suggestions on how to write an anonymous PHP proxy (that runs on a shared host - so I can't do some fancy mod_rewrite trickery or anything and simulate a real proxy, unfortunately)
Also, feel free to substitute PHP with Perl, Python, or Ruby (or some other scripting language that can run server-side). I'm asking about PHP because it's the easiest to deploy - but if there are compelling arguments for another language, I'm open to that too!
posted by mebibyte to computers & internet (7 comments total)
1 user marked this as a favorite
posted by roue at 4:37 AM on September 13, 2007