Question

Tried below simple ones

code1 using Net::SMS::WAY2SMS

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
$sms->send(q[testing
sending
sms]);
#end1 

No error displayed and not working

code2 using Net::SMS::160By2

#!C:/strawberry/perl/bin/perl.exe
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);  
#end2

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

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

Was it helpful?

Solution

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 160By2.pm 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 = 'http://160by2.com/FebSendSMS';

$mech here is trying to get the above URL.

my $sendsms_uri = URI->new($SENDSMS_URL);
$mech->get($sendsms_uri->as_string);`

and then at the end it does

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

$form->action($sendsms_submit_uri);

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

OTHER TIPS

Look at SMS::Send - it provides a sane interface to various SMS::Send::* drivers for various SMS-sending facilities - so you can change providers easily without major changes to your code.

I personally use AQL (www.aql.com) via SMS::Send::AQL - they're a UK-based company, though, so may not be very useful for you if you're outside the UK.

If you can't find an SMS::Send::* driver for a service you wish to use, you could write and release your own.

There is a smscmd1 sample can be referred. It is called by using PERL system Syntax :

 system("./smscmd1", "$ARGV[0]","$ARGV[1]","$ARGV[3]","$ARGV[4]") 

Refer http://www.sms4mail.com/smsmail/smscmd.htm for more details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top