[root@dr-mysql01 ~]# cat aa.pl
use LWP::UserAgent;
use Data::Dumper;
my $ua = LWP::UserAgent->new;
$phone=$ARGV[0];
$cc=$ARGV[1];
$ua->timeout(10);
$ua->env_proxy;
$ua->agent("Mozilla/8.0");
$host = "xxxxxxxx";
my $response = $ua->get($host);
my $var= Dumper($ua);
print $var;
print "\n";
my $var= Dumper($response);
print $var;
print "\n";
$ua->default_headers;
if ($response->is_success) {
print $response->decoded_content; # or whatever
}
else {
die $response->status_line;
}
[root@dr-mysql01 ~]# set -o vi
[root@dr-mysql01 ~]# perl aa.pl 180722722237 test
$VAR1 = bless( {
'max_redirect' => 7,
'protocols_forbidden' => undef,
'show_progress' => undef,
'handlers' => {
'response_header' => bless( [
{
'owner' => 'LWP::UserAgent::parse_head',
'callback' => sub { "DUMMY" },
'm_media_type' => 'html',
'line' => '/usr/share/perl5/LWP/UserAgent.pm:609'
}
], 'HTTP::Config' )
},
'no_proxy' => [],
'protocols_allowed' => undef,
'use_eval' => 1,
'requests_redirectable' => [
'GET',
'HEAD'
],
'timeout' => 10,
'def_headers' => bless( {
'user-agent' => 'Mozilla/8.0'
}, 'HTTP::Headers' ),
'proxy' => {},
'max_size' => undef
}, 'LWP::UserAgent' );
$VAR1 = bless( {
'_protocol' => 'HTTP/1.1',
'_content' => '<?xml version="1.0" encoding="utf-8" ?><returnsms>
<returnstatus>Success</returnstatus>
<message>ok</message>
<remainpoint>31686</remainpoint>
<taskID>5352823</taskID>
<successCounts>1</successCounts></returnsms>',
'_rc' => '200',
'_headers' => bless( {
'x-powered-by' => 'ASP.NET',
'client-response-num' => 1,
'cache-control' => 'private',
'set-cookie' => 'ASP.NET_SessionId=d2iytlqkqwu00f55ds3aukug; path=/; HttpOnly',
'date' => 'Wed, 06 Jan 2016 09:17:22 GMT',
'client-peer' => '211.149.197.95:8888',
'content-length' => '217',
'x-aspnet-version' => '2.0.50727',
'client-date' => 'Wed, 06 Jan 2016 09:14:14 GMT',
'content-type' => 'text/xml; charset=UTF-8',
'server' => 'Microsoft-IIS/6.0'
}, 'HTTP::Headers' ),
'_msg' => 'OK',
'_request' => bless( {
'_content' => '',
'_uri' => bless( do{\(my $o = 'http://211.149.197.95:8888/sms.aspx?action=send&userid=74&account=SDK&password=9&mobile=18072722237&content=test&sendTime=&extno=')}, 'URI::http' ),
'_headers' => bless( {
'user-agent' => 'Mozilla/8.0'
}, 'HTTP::Headers' ),
'_method' => 'GET',
'_uri_canonical' => $VAR1->{'_request'}{'_uri'}
}, 'HTTP::Request' )
}, 'HTTP::Response' );
perl 中的对象 bless
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
上一篇:perl bless例子
下一篇:perl 创建包
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
java将map中的值放到对象中
java将map中的值放到对象中
Java if语句 java -
Pomelo游戏开发中的domain对象
介绍Pomelo游戏开发中的domain对象概念及使用技巧。
pomelo domain bearcat treasures -
perl之bless的用法
perl之bless的用法
perl之bless的用法 -
Perl 中的对象
Perl 中的对象让我们开始在Perl中实现...
perl 数据结构 多态性 面向对象 垃圾收集 -
第章 perl 中的对象:
Perl 中对象一个对象(还可以称作一个实例...
perl 散列表 数据结构 唯一标识 子例程