[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 "
";
my $var= Dumper($response);
print $var;
print "
";
$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' );