Proxy with PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
miladrahimi
Forum Newbie
Posts: 1
Joined: Sat Jun 06, 2015 1:23 pm

Proxy with PHP

Post by miladrahimi »

Hello.
I wonder if it's possible to make something like SOCKS5 or HTTP proxy with PHP.
A SOCKS is a IP:PORT which plays a proxy role and all the internet traffic will be passed through it.
Is it possible to make such a proxy with PHP, for example WEBSITE_IP:PORT which get the user request and returns something.
I know it may be possible to implemented by socket programming.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Proxy with PHP

Post by requinix »

Any proxy that operates on the HTTP layer can be done with PHP. Make sure your web server will play nicely with the requests, then PHP will receive them as any other request and you can work with them however you want.

So a plain HTTP proxy you can do, but a SOCKS proxy not so much. You still can, of course, because PHP does sockets in general, you just can't write "normal" PHP code to implement it.
Post Reply