line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
#Copyright (c) 2001 Dmitry Dmitriev. All rights reserved. |
4
|
|
|
|
|
|
|
#http://www-sms.sourceforge.net/ |
5
|
|
|
|
|
|
|
#This program is free software; you can redistribute it and/or |
6
|
|
|
|
|
|
|
#modify it under the same terms as Perl itself. |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package WWW::SMS::Beeline; |
9
|
1
|
|
|
1
|
|
594
|
use Telephone::Number; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
183
|
|
10
|
|
|
|
|
|
|
require Exporter; |
11
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
@EXPORT = qw(); |
13
|
|
|
|
|
|
|
@EXPORT_OK = qw(@PREFIXES _send MAXLENGTH); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
@PREFIXES = (Telephone::Number->new('7', [ |
16
|
|
|
|
|
|
|
qw(095 901 903) |
17
|
|
|
|
|
|
|
], undef) |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$VERSION = '1.01'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub MAXLENGTH () {156} # maximum message length |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub hnd_error { |
25
|
0
|
|
|
0
|
0
|
|
$_ = shift; |
26
|
0
|
|
|
|
|
|
$WWW::SMS::Error = "Failed at step $_ of module Beeline.pm\n"; |
27
|
0
|
|
|
|
|
|
return 0; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _send { |
31
|
0
|
|
|
0
|
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
1
|
|
6
|
use LWP::UserAgent; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
34
|
1
|
|
|
1
|
|
5
|
use HTTP::Request::Common qw(GET POST); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
330
|
|
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
$self->{smstext} = substr($self->{smstext}, 0, MAXLENGTH - 1) if (length($self->{smstext})>MAXLENGTH); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $ua = LWP::UserAgent->new; |
39
|
0
|
|
|
|
|
|
$ua->agent('Mozilla/5.0'); |
40
|
0
|
0
|
|
|
|
|
$ua->proxy('http', $self->{proxy}) if ($self->{proxy}); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#STEP 1 |
44
|
0
|
|
|
|
|
|
my $step = 1; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
$req = POST 'http://www.beeonline.ru/mini-site/xt_sendsms_msg.xsp', |
47
|
|
|
|
|
|
|
[ phone => $self->{telnum}, |
48
|
|
|
|
|
|
|
smpl_phone => $self->{telnum}, |
49
|
|
|
|
|
|
|
service => '1', |
50
|
|
|
|
|
|
|
number_sms => 'name_sms_send', |
51
|
|
|
|
|
|
|
prf => $self->{intpref} . $self->{prefix}, |
52
|
|
|
|
|
|
|
termtype => 'G', |
53
|
|
|
|
|
|
|
message => $self->{smstext}, |
54
|
|
|
|
|
|
|
mlength => "156" |
55
|
|
|
|
|
|
|
]; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
my $file=$req->content; |
58
|
0
|
|
|
|
|
|
$req = GET 'http://www.beeonline.ru/mini-site/xt_sendsms_msg.xsp?'.$file.'&y=%36&x=%33%34'; |
59
|
0
|
|
|
|
|
|
$req->content_type('application/x-www-form-urlencoded'); |
60
|
0
|
|
|
|
|
|
$req->referer('http://www.beeonline.ru/mini-site/sendsms.xsp'); |
61
|
0
|
|
|
|
|
|
$res = $ua->request($req); |
62
|
0
|
0
|
|
|
|
|
$res->is_success() || (return &hnd_error($step)); |
63
|
|
|
|
|
|
|
#STEP 1 |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#STEP 2 |
66
|
0
|
|
|
|
|
|
$step++; |
67
|
0
|
0
|
|
|
|
|
($res->content =~ /Ваше сообщение отправлено!/) || (return &hnd_error($step)); |
68
|
|
|
|
|
|
|
#STEP 2 |
69
|
0
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
1; |