user3721636
user3721636

Reputation: 45

Tunneling Proxies through PHP

Is it possible to have this setup:

[browser] -> [proxy_1 2.2.2.2:800x (PHP_SCRIPT)] -> [proxy_2 1.1.1.x:8080 (HTTP)] -> [remote server]

I have many proxies like this:

1.1.1.1:8080
1.1.1.2:8080
1.1.1.3:8080

I would like the PHP script to accept incoming connection, and forward it to my real proxies, so that I could simply give out my masked proxies:

2.2.2.2:8080
2.2.2.2:8081
2.2.2.2:8082

Is this possible with PHP sockets? Thanks!

Upvotes: 2

Views: 1698

Answers (1)

denisvm
denisvm

Reputation: 730

Yes, it is possible. You just need to make sure that your proxy1 will forward the connections to proxy2, and only proxy2 will forward directly the connections. If you want to use PHP sockets you will need to parse HTTP headers and process the entire connection. You could use curl library for this.

Here is a project which uses the proxy concept with curl: https://github.com/jenssegers/php-proxy

Upvotes: 2

Related Questions