前言
更多内容,请访问我的 个人博客。
GET
use LWP::UserAgent;
my $browser = LWP::UserAgent->new(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6');
my $TARGET_URL = "http://www.omim.org/entry/".$OMIM;
my $response = $browser->get($TARGET_URL);
my $htmlcontent = $response->content;
POST
use LWP::UserAgent;
my $browser = LWP::UserAgent->new;
$browser->timeout(600); #设置缓冲时间600s
my $TARGET_URL = "http://122.114.25.231:8582/emp/selfOpenAccountAction!khQuery.action?step=xhdq";
my %headers=(
'Accept'=>'text/html, application/xhtml+xml, */*',
'Accept-Encoding'=>'gzip, deflate',
'Accept-Language' => 'zh-CN',
'Cache-Control' => 'no-cache',
'Connection' => 'Keep-Alive',
'Content-Length' => '71',
'Content-Type' => 'application/x-www-form-urlencoded',
'Cookie' => 'JSESSIONID=4D4E92EB8830CA8B5DC7F9AA1751AC71',
'Host' => '122.114.25.231:8582',
'Referer' => 'http://122.114.25.231:8582/emp/query.jsp',
'User-Agent' => 'Mozilla/5.0 (MSIE 9.0; Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko');
my $response = $browser->post($TARGET_URL,
[
'dealer.certificateNum' => $id,
'dealer.name' => $name,
]
,%headers
);
if ($response->is_success) {
my $htmlcontentStr = $response->content;
}