I wrote a script that connects to an IRC server 开发者_如何学Pythonusing sockets, but how would I connect through a proxy? I thought it might be possible using curl, but it seems it's more suited to HTTP and doesn't support continuously sending packets. I thought it would be as simple as connecting to the proxy through fsockopen() and sending the packets through, but how do I tell the proxy (SOCKS 4/5) to connect to the IRC server? I can't fsockopen() inside fsockopen(), if you know what I mean (probably not).
Any help or ideas or whatever?
Thanks.
Take a look at that:
http://de.php.net/manual/de/function.fsockopen.php#82586
Should do what you want ;-)
Basically your first command after opening the socket to your proxy would be 'CONNECT irc.whatever.com:6667' and then continue as if you were connected directly to the irc server.
I'm not exactly sure of the exact SOCKS commands.
精彩评论