Example Scripts
TeleSign Mobile provides you with sms gateway integration tools as ready-made scripts available to help you managing connection to our SMS gateway over your chosen programming language. As developers solution these scripts all work with the HTTP application interface - API. Join us now and get 10 SMS to test your implementation and our HTTPS API.
| ASP PHP Perl Java C# VB.NET |
ASP Example
Send SMS using ASP code. The example below demonstrates how to connect to TeleSign Mobile SMS Gateway and send SMS using ASP code. Register for an sms account and you will immediately receive 10 test messages to try our service.
<% ' creating object set Sms = Server.CreateObject("RoutoTelecom.Sender") ' setting parameters Sms.Username = "your_username" Sms.Password = "your_password" Sms.MobileNo = "44791232321" Sms.SMSType = "SMS" Sms.Message = "Test Message" ' optional parameters Sms.Owner = "4479987654321" ' these two parameters are required for delivery report request Sms.Mess_id = "some_mess_id" Sms.Delivery = "1" ' sending SMS and printing result SmsResult = Sms.Send Response.Write SmsResult set Sms = Nothing %>
PHP Example This example shows how to use the PHP code to send text messages through the TeleSign Mobile SMS Gateway. Browse our API script library for more PHP examples available for download bellow. Register for an HTTP API account and you will instantly receive 10 test SMS messages to trial our service for free.
<html> <body> <form action="sendsms.php" method="post">
Number: <input type="text" name="number"> Message: <input type="text" name="message"> <input type="submit" value="Send SMS">
</form> </body> </html>
// include RoutoSMS class include("RoutoTelecomSMS.php"); // creating object $sms = new RoutoTelecomSMS; // setting login parameters $sms->SetUser("your_username"); $sms->SetPass("your_password"); $sms->SetOwnNum("44792838383838"); // optional $sms->SetType("SMS"); // optional // get values entered from FORM $sms->SetNumber($number); $sms->SetMessage($message); // send SMS and print result $smsresult = $sms->Send(); print $smsresult;
|
Perl Example Here is an example of how you can use the Perl SMS code to send short messages through the TeleSign Mobile SMS Gateway.
Our Perl Class (with lots of more Perl examples) is available to download below. Register for an HTTP API account and we will give you 10 test messages so that you can try our service.
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
my $username = "your_username";
my $password = "your_password";
my $number = "123456789";
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
my $response = $ua->post(
"http://smsc5.routotelecom.com/cgi-bin/SMSsend",
{
number => $number,
user => $username,
pass => $password,
message => "Test message"
});
if ($response->is_success) {
print $response->decoded_content; }
else {
die $response->status_line; }
Java Example With our Java SMS API you can easily integrate our SMS Gateway to your Java application. The Java SMS code example below show how you can connect and send text messages through TeleSign Mobile SMS Gateway.
Our Java SMS API is available to download below. Register for an HTTP API account and you will immediately receive 10 text messages to try out our SMS Gateway service.
<html>
<head>
<title>Routo</title>
</head>
<body>
<h1>Routo Telecom</h1>
<br/><br/>
<!-- Include Routo SMS class-->
<jsp:useBean id="sms" class="routosms.RoutoTelecomSMS" />
<!-- Setting SMS parameters-->
<% routosms.RoutoTelecomSMS routo = new routosms.RoutoTelecomSMS();%>
<!-- creating object-->
<% routo.SetUser("your_username");%>
<% routo.SetPass("your_password");%>
<% routo.SetNumber("44791212121212");%>
<% routo.SetOwnNumber("44792838383838");%> <!-- optional-->
<% routo.SetType("SMS");%> <!-- optional-->
<% routo.SetMessage(message);%>
<!-- Send SMS and print result-->
<%=routo.Send()%>
</body> </html>
C# Example The example below shows how you can connect and send short SMS messages through the TeleSign Mobile SMS Gateway using C# SMS code.
Our SMS C# class is available to download below. Register for an HTTP API account with us we will give you 10 test messages to test our gateway.
protected void Page_Load(object sender, EventArgs e)
{
string number = Request.QueryString["number"];
string message = Request.QueryString["message"];
RoutoSMSTelecom routo = new RoutoSMSTelecom();
routo.SetUser("your_username");
routo.SetPass("your_password");
routo.SetNumber("44791212121212");
routo.SetOwnNumber("44792838383838");
routo.SetType("SMS");
routo.SetMessage(message);
string header = routo.Send();
sms.InnerText = header;
}
VB.NET Example The example below shows you how you can use VB.NET SMS code to send text messages through TeleSign Mobile SMS Gateway. Browse our VB.Net source to include SMS API VB.NET file to your application. Register for an HTTP API account and you will immediately
receive 10 test messages to try our service.
Download:
Routotelecom.vb source
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim routosender As New RoutoSend
routosender.user = uname.Text
routosender.password = passwrd.Text
routosender.number = recip.Text
routosender.source = ssender.Text
routosender.message = mmesage.Text
routosender.send()
End Sub