You are here: Re: HTTP tunneling with PHP (prefereably PHP5)? « PHP Programming Language « IT news, forums, messages
Re: HTTP tunneling with PHP (prefereably PHP5)?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация