Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Automating sms sending by through Way2sms in Perl

by Cupidvogel (Initiate)
on Aug 26, 2012 at 15:42 UTC ( [id://989838]=perlquestion: print w/replies, xml ) Need Help??

Cupidvogel has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to send sms through Way2sms using Perl LWP. The login part is being successful, after which I save the cookies to a local file. The welcome page after being logged in shows a Send SMS link, clicking on which one is redirected to another page with two inputs for mobile number and sms text and a button for submitting and sending the sms. Firebug reveals the page structure, from the Iframe url and the form's action attribute, I constructed the form action's absolute URL and submit the form accordingly, with the cookie stored in the file. However, the sms isn't sent. What I am doing wrong here? The code is as follows. (The name attributes for the two text inputs are correct, taken by observing the source code in Firebug)
use LWP::UserAgent; use HTTP::Cookies; my $cookie_jar = HTTP::Cookies->new( file => "cookies.txt", autosave => 1, ); my $ua = LWP::UserAgent->new( agent => 'Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox +/14.0.1', cookie_jar => $cookie_jar, ); my $response = $ua->post( 'http://site2.way2sms.com/contentt/bar/Login1.action', { username => $user, password => $pass, } ); if ( $response->is_redirect ) { $response = $ua->get( $response->header('Location') ); print 5 if $response->decoded_content =~ /Kaustav Mukherjee/i; #pr +ints it, showing that the login is successful } my $smsresp = $ua->post("http://site5.way2sms.com/jsp/quicksms.action" +,[MobNo=>$mob,textArea=>'Hello World']);

Replies are listed 'Best First'.
Re: Automating sms sending by through Way2sms in Perl
by pemungkah (Priest) on Aug 26, 2012 at 20:47 UTC
    I think what you'll want to do is use a recording proxy to watch the actual data flowing with GET/PUT/POST and duplicate that. You should also check that you're following the Terms of Service; if you're having your server ping you with a message when it goes down, you should be fine.

    If you're sending commercial messages, note that that's not permitted under the TOS:

    ...Way2sms.com is a free messaging site for person to person communication and is not meant for commercial communication like marketing, promotional or advertisement messages. Such commercial messages are Restricted Messages. If a Registered User is found to send Restricted Messages, his account will be completely blocked.
    So automating messages seems to be legit, but using automated messages for spam will get you shut down. It's up to you to determine if you're sending legitimate messages or not.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://989838]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 21:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found