|
Posted by NC on 10/09/59 11:36
Paul Dodowa wrote:
>NC wrote:
> > It's not that difficult. Basically, all you need to do is to establish
> > a connection with your proxy server using fsockopen() and then send a
> > CONNECT request... It's rather straightforward, so you can wrap it up
> > in all the OOP you want...
>
> Have you got any good links/references that show how this is done?
Let's say you want to connect to mail.example.com on port 25 through an
HTTP
tunnel using a proxy server called your.proxy.server:
$host = 'your.proxy.server';
$port = '4480'; // 4480 is the default HTTP proxy port
$fp = fsockopen($host, $port)
or die ("ERROR: Could not connect to proxy server $host on port
$port");
fputs($fp, "CONNECT mail.example.com:25 HTTP/1.0\r\n\r\n");
$response = '';
do {
$line = fgets($fp, 10240);
$response .= $line;
} while (trim($line) <> null);
// Now $response contains the complete response of mail.example.com.
// The response should be parsed to determine whether mail.example.com
// is ready to communicate. If it is, you can start sending requests
to
// mail.example.com using fputs() and read responses using fgets().
fclose ($fp);
Cheers,
NC
Navigation:
[Reply to this message]
|