-
Notifications
You must be signed in to change notification settings - Fork 0
/
mobile-get
executable file
·43 lines (36 loc) · 1022 Bytes
/
mobile-get
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! perl
use strict;
use warnings;
use Data::Dumper;
use LWP::UserAgent;
use Getopt::Long;
use Pod::Usage;
my $au;
my $softbank;
GetOptions(
'docomo' => \my $docomo,
'au' => \$au,
'ezweb' => \$au,
'softbank' => \$softbank,
'vodafone' => \$softbank,
'D|dump-header' => \my $dump,
);
my $url = shift @ARGV or pod2usage;
my $agent;
$agent = 'DoCoMo/2.0 N02B(c500;TB;W24H16)' if $docomo;
$agent = 'UP.Browser/3.2.9.1-UPG1 UP.Link/3.2' if $au;
$agent = 'SoftBank/1.0/DM001SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1' if $softbank;
die "missing agent type" unless $agent;
my $ua = LWP::UserAgent->new(agent => $agent);
my $res = $ua->get($url);
print Dumper($res->headers) if $dump;
if ($res->is_success) {
print $res->content;
} else {
print $res->status_line;
}
__END__
=head1 SYNOPSIS
% mobile-get --docomo http://example.com/
% mobile-get --ezweb http://example.com/
% mobile-get --softbank http://example.com/