#!/usr/bin/perl
#####################################
# jondy
# QQ:222411
# http://blog.youkuaiyun.com/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>;
#####################################
# jondy
# QQ:222411
# http://blog.youkuaiyun.com/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>;
此博客展示了一段Perl代码,利用IO::Socket模块创建套接字,向指定主机和端口发起HTTP POST请求。代码中设置了请求头和请求体等信息,最后打印出响应内容,涉及socket、IO等信息技术相关内容。
9742

被折叠的 条评论
为什么被折叠?



