Trying to send SMS from PC to Mobile but unable to select "Send Free SMS" button on the home page.
Please help how to select options like "Send free SMS" or "Start earnings"after login.
Please find the code below that I tried
use WWW::Mechanize;
use Compress::Zlib;
use HTML::TokeParser;
my $mech = WWW::Mechanize->new();
my $username = "";
my $keyword = "";
my ($text,$mobile);
my @mobilenos;
my $morenos = $ARGV[0];
@mobilenos = $morenos;
print @mobilenos;
$text = $ARGV[1];
$deb = 1;
print "Total Character of message is ".length($text)."\n" if($deb);
$text = $text."\n\n\n\n\n" if(length($text) < 135);
$mech->get("http://wwwl.way2sms.com/content/index.html");
unless($mech->success())
{
print "successed";
exit;
}
$dest = $mech->response->content;
print "Fetching...\n" if($deb);
if($mech->response->header("Content-Encoding") eq "gzip")
{
$dest = Compress::Zlib::memGunzip($dest);
$mech->update_html($dest);
}
$dest =~ s/<form name="loginForm"/<form action='..\/Login1.action' nam
+e="loginForm"/ig;
$mech->update_html($dest);
$mech->form_with_fields(("username","password"));
$mech->field("username",$username);
$mech->field("password",$keyword);
print "Loggin...\n" if($deb);
$mech->submit_form();
$dest= $mech->response->content;
$mech->click_button(value => "Send Free SMS");
foreach $mobile (@mobilenos){
chomp($mobile);
print "\nMessage sending to ".($mobile)."\n";
print "Sending ... \n" if($deb);
$mech->field("Mobile Number",$mobile);
$mech->field("Message",$text);
$mech->click(value => "Send SMS");
if($mech->success())
{
print "Done \n" if($deb);
}
else
{
print "Failed \n" if($deb);
exit;
}
$dest = $mech->response->content;
if($mech->response->header("Content-Encoding") eq "gzip")
{
$dest = Compress::Zlib::memGunzip($dest);
}
$x = $mech->content();
open(Myfile,'>',"rt.txt");
print Myfile $x;
if($dest =~ m/successfully/sig)
{
print "Message sent successfully \n" if($deb);
}
}
print "Message sent to all the numbers\n Bye.\n";
exit;