navin navin - 1 year ago 75
Perl Question

how to send sms to using perl?

Tried below simple ones

code1 using

use strict;
use warnings;
use Net::SMS::WAY2SMS;

my $sms = Net::SMS::WAY2SMS->new(
'user' => 'user_name' ,
'password' => 'secret_password',
'mob' => ['1234567890', '0987654321']

# multi line sms

No error displayed and not working

code2 using

use strict;
use warnings;
use Net::SMS::160By2;
my $username = "9823763544";
my $password = "sssssss";
my $msg = "Hi";
my $to = "9922334455";
my $obj = Net::SMS::160By2->new($username, $password);
$obj->send_sms($msg, $to);

Error:can't call method "action" on undefined values at C:/strawberry/perl/site/lib/net/SMS/ at line 196.

I have also tried several other scripts and none of them worked

Answer Source

The reason why Net::SMS::WAY2SMS is not working is the issue with module. There is no standard API being provided by Way2SMS team, and they keep changing their interface. That is why all the Android apps related to Way2SMS also stop working after a month or two (as soon as Way2SMS team changes interface). As long as Way2SMS doesn't provide an API, you'll not get a stable solution.

Same issue with 160By2.

Line 196 of is $form->action($sendsms_submit_uri); and the error you get is can't call method "action" on undefined values. That means $form is undefined.

In module author has used our $SENDSMS_URL = '';

$mech here is trying to get the above URL.

my $sendsms_uri = URI->new($SENDSMS_URL);

and then at the end it does

my $form = $mech->form_name('frm_sendsms'); and


But if you notice the $SENDSMS_URL gives 404 error (This URL doesn't even exist). Hence it gives error.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download