Textit.biz Serving Sri Lanka since 2011.

Textit.biz SMS Gateway Integration

BASIC HTTP API

BASIC HTTP API

The Reliable, scalable and customizable HTTP API is used to quickly and easily integrate textit.biz gateway into websites and applications. The HTTP API is supported by most languages and can be used together with all applications and software solutions. It is extremely reliable, quick, convenient and can be debugged easily.HTTP API can be used for Broadcast (Send SMS Messages) or Check Balance of your account
 

Basic Integration


https://www.textit.biz/sendmsg/?id=xxxxxxx&pw=xxxx&to=xxxx&text=xxxxxx

(Info : textit.biz Supports both GET and POST methods)


Basic Parameters

id = <Your Phone Number in international format>
pw = <Password>
to = <Recipients Phone Number in international format>
text = <Text Message (URL Encoded)>

example:

https://www.textit.biz/sendmsg/?id=94123456789&pw=1234&to=07987654321&text=Hello+World



Optional Parameters

ref
Optional Passthrough Variable upto 15 characters, only shows in reports for future reference
eg. ref=NewCampaign


schd
Schedule Send Date / Time. Textit.biz will store the message in servers and process at the given time.
Expected Formats : YYYY‐MM‐ DD_HH:MM Or YYYYMMDDHHMM

Eg. schd=2021‐01‐31_23:59 or schd=202101312359



Example scripts in your choice of languages are given below. modify the given code to match your requirements.


If you would like to contribute by improving or adding new code blocks, please send your submissions to info@textit.biz. Selected contributions will be featured in the integration section, with proper attribution to your name, company, or website.  

  • PHP
  • cURL
  • C #
  • JAVA
  • VB.NET

PHP

$user = "94123456789";
$password = "0000";
$text = urlencode("This is an example message");
$to = "94000000000";

$baseurl ="https://www.textit.biz/sendmsg";
$url = "$baseurl/?id=$user&pw=$password&to=$to&text=$text";
$ret = file($url);

$res= explode(":",$ret[0]);

if (trim($res[0])=="OK")
{
echo "Message Sent - ID : ".$res[1];
}
else
{
echo "Sent Failed - Error : ".$res[1];
}

cURL

Use the cURL/PHP script below to send SMS. You can modify this basic script to your requirements.

function get_web_page( $url )
{
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
);

$ch = curl_init( $url );
curl_setopt_array( $ch, $options );
$content = curl_exec( $ch );
$header = curl_getinfo( $ch );
curl_close( $ch );

return $content;
}

$user = "941234567890";
$password = "1234";
$text = urlencode("This is an example message");
$to = "94000000000";

$baseurl ="https://www.textit.biz/sendmsg";
$url = "$baseurl/?id=$user&pw=$password&to=$to&text=$text";
$ret = get_web_page($url);
$res= explode(":",$ret);

if (trim($res[0])=="OK")
{
echo "Message Sent - ID : ".$res[1];
}
else
{
echo "Sent Failed - Error : ".$res[1];
}

C# Script

using System.Net;
using System.IO;
WebClient client = new WebClient ();

client.Headers.Add ("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");

client.QueryString.Add("id", "947123456789");
client.QueryString.Add("pw", "XXXX");
client.QueryString.Add("to", "94000000000");
client.QueryString.Add("text", "This is an example message");
string baseurl ="https://www.textit.biz/sendmsg";
Stream data = client.OpenRead(baseurl);
StreamReader reader = new StreamReader (data);
string s = reader.ReadToEnd ();
data.Close ();
reader.Close ();
return (s);

JAVA Code

Use the JAVA codings below to send SMS. You can modify this basic code to your requirements.
change values of id, pw, to and text with your user id, password, senders telephone number(to) and the message(text)

import java.net.*;
import java.io.*;

public class URLReader {
public static void main(String[] args) throws Exception {

URL textit = new URL("https://textit.biz/sendmsg/index.php?id=94000000000&pw=0000&to=0000000000&text=Test+SMS");
BufferedReader in = new BufferedReader(
new InputStreamReader(textit.openStream()));

String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}



more details can be found at the oracle java documentation at https://docs.oracle.com/javase/tutorial/networking/urls/index.html

VB.NET

Imports System.Net
Imports System.IO
Dim client As WebClient = New WebClient
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
client.QueryString.Add("id", "940000000")
client.QueryString.Add("pw", "0000")
client.QueryString.Add("to", "0772823050")
client.QueryString.Add("text", "This is an example message")
Dim baseurl As String = "https://textit.biz/sendmsg/index.php"
Dim data As Stream = client.OpenRead(baseurl)
Dim reader As StreamReader = New StreamReader(data)
Dim s As String = reader.ReadToEnd()
data.Close()
reader.Close()
Return