用IO::Socket实现POST的代码
Sunday, December 18th, 2005#!/usr/bin/perl
#####################################
# jondy
# http://blog.csdn.net/jondynet
#####################################
use strict;
use warnings;
use IO::Socket;
my $host = “221.208.250.138″;
my $port = “80″;
my $sock = IO::Socket::INET->new(“$host:$port”)
|| die “Socket() error, Reason : $! \n”;
print $sock “POST /secu/fch_hljcontentauthact.jsp?isADSL=0
&qs=cmV0dXJsPWh0dHA6Ly8yMjEuMjA4LjI1MC4xMzgvZm
NoX2xvZ2luL2xvZ2luLmpzcCZpY3BpZD0xMDAxJmZvcmNl
bG9naW49MCZpc3BpZD0xMDAwMSZjaGFsbGVuZ2U9MTEzND
c5MTg5NDc3MSZ0aW1ld2luZG93PTEyMzQ1Ng== HTTP/1.1\r\n”;
print $sock “Accept: image/gif, image/x-xbitmap, image/jpe
g, image/pjpeg, application/x-shockwave-flash, */*\r\n”;
print $sock “Accept-Language: zh-cn\r\n”;
print $sock “Content-Type: application/x-www-form-urlencoded\r\n”;
print $sock “Accept-Encoding: gzip, deflate\r\n”;
print $sock “User-Agent: Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.2; .NET CLR 1.1.4322)\r\n”;
print $sock “Host: $host\r\n”;
print $sock “Content-Length: 105\r\n”;
print $sock “Connection: Keep-Alive\r\n”;
print $sock “Cache-Control: no-cache\r\n”;
print $sock “\r\n”;
print $sock “stopformer=false&clientusername=&showordernot
ice=1&localIP=&usernameinput=username&password
input=123456\r\n”;
print $sock “\r\n”;
print <$sock>;