Perl高级开发:查看一个页面的修改时间

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

--> #!/usr/bin/perl
use warnings;
use strict;

use IO::Socket;

my $remote_host = '192.168.1.107';
my $URI = '/index.html';
my $remote_port = 80;
my @response;
my $date_last_modified = 'unknown';

my $socket = IO::Socket::INET->new
(       PeerAddr => $remote_host,
        PeerPort => $remote_port,
        Proto => 'tcp',
        Timeout => '10',
        Type => SOCK_STREAM,
) or die "Connecting to $remote_host:$remote_port:$@";
print $socket "HEAD $URI HTTP/1.0\n\n";
@response = <$socket>;
foreach (@response){
        $date_last_modified =$1 if (/^Last-modified: (.+?)\n/i);
}
print "Last modification date: $date_last_modified\n";

close ($socket);
exit;

暂无引用通告

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

发表评论

最新资源

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

关于此日记

此日记由 supersun 发表于 2007年3月26日 17:09

此Blog上的上一篇日记Perl高级编程:作用域和可见性

此Blog上的下一篇日记perl中编码的转换

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