DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Send Sms In Perl Via Sms Gateway Www.smsmatrix.com

07.09.2010
| 4106 views |
  • submit to reddit
        Send SMS via SMS Gateway provided by <a href="http://www.smsmatrix.com">www.smsmatrix.com</a>

use LWP::UserAgent;
use HTTP::Request::Common;

my $ua = LWP::UserAgent->new();
my $res = $ua->request
(
 POST 'http://www.smsmatrix.com/matrix',
 Content_Type  => 'application/x-www-form-urlencoded',
 Content       => [ 'username' => 'user888@yahoo.ca',
                    'password' => 'pass7782',
                    'callerid' => '12501231233', # optional (for 2-way sms)
                    'phone' => '12506063167',
                    'txt' => 'this is a test' ]
);

if ($res->is_error) { die "HTTP Error\n"; }
print "Matrix API Response: " . $res->content . "\n\n";