maysam
maysam

Reputation: 519

proxy in php script and connect to it via browser

can i find any php script that act as proxy server(socks ,http,..) and connect to it via firefox (like any other proxy server ) (for example run script first after that script act like proxy,...) i want to bypass filtring

i seen this sourceforge.net/projects/php-proxy Already , i need connect to it like socks proxy

i dont have any server for using as ssh Tunneling or install other proxy application in it i have only server and allow run any php screapt in it

tanks

Upvotes: 0

Views: 1809

Answers (1)

Frog
Frog

Reputation: 1641

A proxy server basically does one simple thing: it loads the date (to make it easier I'll assume it's a website in the rest of answer) you request and sends it to you. Because you do not directly connect to the website, it thinks you are at the location that does request to page: your server.

There are multiple ways to connect to a proxy server, some use a custom protocol, while you can connect to others using http(s) in a web browser. Because you mention you want to connect to your proxy using Firefox, I'll assume you want a web proxy such as hidemyass.com.

When you request a web page on a web proxy, the following things happen in this order:

  1. Your computer sends a request to the web proxy. In this request is also the address of the website you want to load;
  2. The proxy opens the website you requested. Since a website is basically just a document of data, you open it using a simple function such as file_get_contents(). Alternatively, you can use CURL for more options and better performance. You save this data in a variable;
  3. The proxy has now got the website, but can't show it to the user yet. Because almost every website loads other files (like stylesheets, scripts, images, or even other HTML documents) you also need to load these using your proxy and not with the user's internet connection. The easiest (and not watertight) way to implement this is probably to look for every http:// in the data and replace it with a request to your proxy server;
  4. Now that you've saved the website in a variable on your server, you just need to show it to the user. You can just print it to the screen. Just be sure to pass the correct headers with the requested file!

Please note that this would not be the perfect proxy server: for that you would for example also need to support https requests and check AJAX requests (or disable Javascript altogether, which many proxy servers do). If you just want to use a proxy server, I suggest you take a look at existing ones (or at the comments in the Sourceforge project you linked to, which contains links to better alternatives). But if you find this an interesting project to undertake, good luck!

Upvotes: 1

Related Questions