#!/usr/bin/perl
#use diagnostics;
#use strict;
#use Getopt::Std;
use vars qw/ %opt /;
use Getopt::Std;
use URI::Escape;
%group = {
admins => (
"7921xxxxxxx",
"123"
),
all => (
"987",
"654"
)
};
$login='login';
$pass='pass';
$gate='1cgw.streamsms.ru';
$from='web';
sub Send
{
# print @_;
my @list=@_;
foreach $list (@list)
{
$cmd="GET \"http://$gate/sendsms.php?user=$login&pwd=$pass&sadr=$from&dadr=$list&text=$msg\"";
# $out=$cmd;
# $out=`$cmd`;
if ($opt_v==1 || $opt_d==1) { print $cmd."\n";}
if ($opt_d==1) { next; }
$out=`$cmd`;
if ($opt_v==1) { print $out."\n";}
}
}
sub usage
{
print STDERR << "EOF";
usage: $0 [-h] [-v|-d] [-g group|-n number] text of sms
-h :help
-v : verbose
-f : from
-g : group (from code), mb admins
-n : phone number, 11 digits (7921xxxxxxx), without +
-d : dumb mode - only show
EOF
exit;
}
if ($#ARGV<1)
{
#exit ("see usage");
usage();
exit();
}
@admin = ('7921xxxxxxx');
@admins = ('7921xxxxxxx','7921yyyyyyy');
@test = ('123','456');
getopts ('dhvf:g:n:') ;# or usage();
usage() if $opt_h;
#$msg = join (" ", @ARGV);
#print %opt;
$msg = uri_escape(join (" ", @ARGV));
if (length($opt_f)>0)
{
$from=$opt_f;
}
if (length($opt_g)>0)
{
#Send($group{$opt_g}); #@admins);
Send(@admins);
}
if (length($opt_n)>0)
{
Send($opt_n);
}
Комментариев нет:
Отправить комментарий