A simple HTTP Proxy written in PHP based on php-proxy. All what you need to run your own proxy server is a cheap webhosting with PHP support.
A really simple php proxy that ‘just works’.
This project was put together as a simple system that could be taken and extended to ones needs. I was largely disappointed that none of the other systems seemed to handle POST,COOKIE and SESSION information well - if at all!
The whole system was put together in about 2 hours - and just works!
The code is intentionally bare bones and easy to read. This will enable you to get on with using the proxy for what you actually want! In my case to transparently sniff the data going too & from the browser and a site so that I can extract and log information to a database!
To use the proxy effectively you will require a server with .htaccess and mod_rewrite support.
- Preferably use the proxy on it’s own domain e.g. http://proxy.xyz.com/
- Rename htaccess.txt to .htaccess and install on your server.
- Download the proxy script and install it in the root web folder as ‘index.php’.
- Edit the script and adjust the target domain name you would like to scrape!
Basically I changed the code so that the domain is not hard coded. Here you pass the URL you want to proxify with the
- Call the script without arguments to get a textbox to enter an URL.
- Call the script with the
__url__argument to open the URL, e.g.
- Call the script with the
__clear__argument to clear the session, e.g.
- Make sure PHP has cURL support.
- Download from Github
- Make a subdomain.
- Put the files in the root folder of the subdomain. Rename
allowedIPsitem. If this array is empty, clients from everywhere can use this proxy, and thats probably not what you want. Alternatively you can restrict access with e.g. a
- Sopport for GET, POST, SESSION, COOKIE
- Supports HTTP and HTTPS
- Support for custom Ports, e.g.
- Support for username, password e.g.
- Can stream large files, because it uses a read callback function instead of waiting until everything is downloaded.
- Browser Bookmarklet to proxify a page
- Responsive interface, mobile friendly
- Minimal overhead
- Access blocked IPs. Usually IP blocks are done by your ISP, but a server is not connected to the internet via an ISP.
- Depending on where the Proxy Server is located, you possibly can access geoblocked content. But if this is illegal where you live, perhaps you should not do that.
- Encrypt all traffic to your client, even when the target server does not support HTTPS. However, there may be problems when loading stuff from CDNs or subdomains which do not support HTTPS.
- Hide your IP, the target server will get the IP from your Proxy server.