Leser: 29
1
2
3
4
5
6
7
8
9
10
11
my $useragent = LWP::UserAgent->new;
$useragent->timeout(10);
my $response = $useragent ->get($url);
if ($response->is_success && $response->status_line() eq "100") {
print $response->decoded_content;
}
else {
die $response->status_line;
}
2010-05-16T12:15:36 fredthetroll/edit: Es klappt!
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
#!/usr/bin/perl use strict; use warnings; use URI::Escape; use LWP::UserAgent; my $u = "username"; my $p = "password"; my $to = "0171123456789"; my $type = "basicplus"; my $text = "asdf" . my $url = 'https://sms77.de/gateway/' . '?u=' . uri_escape($u) . '&p=' . uri_escape($p) . '&to=' . uri_escape($to) . '&text=' . uri_escape($text) . '&type=' . uri_escape($type); my $useragent = LWP::UserAgent->new; my $request = HTTP::Request->new('GET'); $useragent->timeout(10); $useragent->protocols_allowed( ['https'] ); $request->url($url); my $response = $useragent->request($request); if (($response->is_success) && ($response->decoded_content eq "100")) { print "Fertig"; } else { die $response->status_line; } print $text;