Example code for SMS integration in language Perl

Send SMS - REST API - JSON

            
use REST::Client;
use MIME::Base64;

my $api_key = "myusername";
my $api_pass = "mypassword";
my $client = REST::Client->new();

$client->addHeader("Authorization", "Basic " .
                   encode_base64("$api_key:$api_pass", ""));
$client->addHeader('Content-Type', 'application/json');
$client->addHeader('charset', 'UTF-8');
$client->addHeader('Accept', 'application/json');

$req = '{
    "message" : "Text of the SMS message",
    "tpoa" : "Sender",
    "recipient" : [
        {
            "msisdn":"12015550123"
        },
        {
            "msisdn":"447400123456"
        },
        {
            "msisdn":"5212221234567"
        }]
    }';

$url = "https://api.labsmobile.com/json/send";

$client->POST($url, $req);
print $client->responseContent();

Credit inquiry - REST API - JSON

            
use REST::Client;
use MIME::Base64;

my $api_key = "myusername";
my $api_pass = "mypassword";
my $client = REST::Client->new();

$client->addHeader("Authorization", "Basic " .
                   encode_base64("$api_key:$api_pass", ""));
$client->addHeader('Content-Type', 'application/json');
$client->addHeader('charset', 'UTF-8');
$client->addHeader('Accept', 'application/json');

$url = "https://api.labsmobile.com/json/balance";

$client->GET($url);
print $client->responseContent();

Send SMS - HTTP/GET

                
use LWP::Simple;
$contents = get("http://api.labsmobile.com/get/send.php?username=[X]&password=[X]&msisdn=34609036253&sender=SENDER&message=This+is+the+message");

Credit inquiry - HTTP/GET

                
use LWP::Simple;
$contents = get("http://api.labsmobile.com/get/balance.php?username=[X]&password=[X]");
  • contact form support

    Sign up!

    Create a user account and send your SMS messages in seconds. You will have all the functionalities and benefits in the same platform.

    Send from API and manage your account with our online application WebSMS.

    Create new account
  • Hey Petit, Services for rural accommodation recommends LabsMobile

    SMS confirmation and reservation reminders for rural accommodation using an online portal.

    Watch more reviews
  • dashboard aplicación online

    Maximum reliability at the best price

    At LabsMobile we only offer direct routes of maximum reliability and quality. Enjoy our platform and all our services for the price of an SMS.

    Pay ONLY for sent messages.

    Check our rates
  • dashboard aplicación online

    Need more info? Contact us!

    Our technical department has professionals with years of experience and we have made multiple integrations.

    We guide and help you through the process.

    Request technical support
  • Results of your sendings or SMS campaigns

    This tutorial explains how to obtain statistics results or reports of SMS sendings made from a WebSMS account.

    Ir al tutorial
loader