Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   Perl (http://www.flasher.ru/forum/forumdisplay.php?f=21)
-   -   Socket (http://www.flasher.ru/forum/showthread.php?t=21765)

mb11 22.10.2001 17:03

Socket
 
подскажите как через сокет достать страничку ?
и какие есть варианты кроме использования сокета ?

спасибо.

SPV 22.10.2001 18:47

use IO::Socket;
$host = "any.host.com";
$file = "/any/file.html";
$query = "GET $file HTTP/1.0\n".
"Host: $host\n".
"\n";
$remote = IO::Socket::INET->new(Proto=>"tcp",PeerAddr=>$host,PeerPort=>"http(80)");
unless ($remote) {exit;}
$remote->autoflush(1);
print $remote $query;
$answer = join("",<$remote>);
close $remote;

$answer - то, что хотел достать.


Часовой пояс GMT +4, время: 05:07.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.