简单的web客户机

| 暂无评论 | 暂无引用通告

-->

和这个脚本 查看一个页面的修改时间 基本一样的

#!/usr/bin/perl
#一个简单的web客户机
use warnings;
use strict;
use IO::Socket;

my @urls=@ARGV;

foreach my $url (@urls){
$url =~ m|(http://)?(.*?)(:(\d+))?(/.*)|;
my $remote_host=$2;
my $remote_port=$4?$4:80;
my $uri=$5;
print "host:$remote_host\nport:$remote_port\nuri:$uri\n";
my $socket = IO::Socket::INET->new
( PeerAddr => $remote_host,PeerPort => $remote_port,Proto => 'tcp',Timeout => '10',Type => SOCK_STREAM,) or die "Connect to $remote_host:$remote_port  : $@\n";
print $socket "GET $uri HTTP/1.0\n\n";
my $response;
$response.= $_ while(<$socket>);
print $response;
close($socket);
}

暂无引用通告

发送引用通告网址: http://supersun.info/mt/mt-tb.cgi/613
如果您想引用这篇日记到您的Blog,请复制上面的链接,放置到您发表文章时的相应界面中。

发表评论

最新资源

  • IMG_1437.JPG
  • line.png
  • bar.png
  • perl_calander.jpg

关于此日记

此日记由 supersun 发表于 2007年4月19日 13:56

此Blog上的上一篇日记英语学习

此Blog上的下一篇日记top500 part3 检测文件的类型及大小

首页归档页可以看到最新的日记和所有日记。