Author Topic: How to send SMS from Perl using HTTP request  (Read 545 times)

0 Members and 1 Guest are viewing this topic.

thomasqueen

  • Guest
How to send SMS from Perl using HTTP request
« on: January 23, 2013, 10:00:30 AM »
a Faster web hosting service
Hey guys. For my project, I needed to find a way to send SMS messages from Perl. It turns out, it is easy to send messages from Perl using HTTP requestes and a software called Ozeki NG SMS Gateway.

To send SMS messages from Perl using HTTP requests, first you need to download, install and configure Ozeki NG SMS Gateway software to your computer. Then import the source code provided below into a new project you write in Perl. After you imported it you can configure the code. You need to customize the values in the source code below.

 #!/usr/bin/perl



###############################################

##   Ozeki NG - SMS Gateway Perl example     ##

###############################################



use HTTP::Request;

use LWP::UserAgent;

use URI::Escape;





###############################################

###            Ozeki NG informations        ###

###############################################

$host = "127.0.0.1";

$port = "9501";

$username = "admin";

$password = "abc123";

$recipient = "+00123456";

$message = "Test Message from Perl";





###############################################

### Putting together the final HTTP Request ###

###############################################

$url  = "http://"       . $host;

$url .= ":" . $port;

$url .= "/api?action=sendmessage&";

$url .= "username="     . uri_escape($username);

$url .= "&password="    . uri_escape($password);

$url .= "&recipient="   . uri_escape($recipient);

$url .= "&messagetype=SMS:TEXT";

$url .= "&messagedata=" . uri_escape("HELLO WORLD");





################################################

####            Sending the message          ###

################################################

$request = HTTP::Request->new(GET=>$url);

$useragent = LWP::UserAgent->new;

$response = $useragent->request($request);





################################################

###        Verifying the response            ###

################################################

if ($response->is_success) {

    print "Message successfully sent"

} else {

    print "Message not sent! Please check your settings!"

}


You can find more info here: newbielink:http://ozekisms.com/index.php?owpn=608 [nonactive]
I hope this will be as useful to you as it is for me!  Thomas

Online obasimiracle

  • Support Expert
  • *****
Re: How to send SMS from Perl using HTTP request
« Reply #1 on: January 23, 2013, 10:12:40 AM »
Nice tutorial mate I have just shared it now
Wisdom pays! Be wise!

thomasqueen

  • Guest
Re: How to send SMS from Perl using HTTP request
« Reply #2 on: January 23, 2013, 10:15:19 AM »
Thanks, I'm glad you liked it :)

Online zeal

  • Lead Admin
  • *****
Re: How to send SMS from Perl using HTTP request
« Reply #3 on: January 23, 2013, 10:16:07 AM »
Do I need pay for sms api separately  and secondly can it work with a free host ?
zealous for perfection

thomasqueen

  • Guest
Re: How to send SMS from Perl using HTTP request
« Reply #4 on: January 23, 2013, 10:17:28 AM »
I'm not sure, but they have all the info on their ozekisms.com website

 


Inside: 3P Techies Blog

Newest Techies

Get Updates


Sign up to get latest updates delivered to your inbox. No Spam, We Promise!

Get Hosting!

a Faster web hosting service
 

Copyright © 3rd Planet Techies. All rights Reserved.

Top || Mobile ||Advertise || Contact Us || Privacy