HTTP(S) API Integration

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

 

BROADCAST API

Basic Integration

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

(Info : textit.biz supports both http and https  | Supports both GET and POST methods)


Basic Parameters
id = <Your Phone Number in international format>
pw = <4 Digit 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

 

Advanced Parameters

Parameter Expected Value(s) Notes
id User ID Required | All Packages
pw Password Required | All Packages
to Recipient Phone Number Required | All Packages

Local Numbers : Any format supported eg. 07XXX... , 7XXX, 947XXX...

International : 00<country code><area code><phone number> eg. 0091987654321

text Message Content Required | All Packages

Must be url formated for reliable delivery (eg. Hello+World or Hello%20World) *Specially applies to GET method.

from Pre-registered Sender ID Optional | Custom Sender ID Package only

set the sender id (masking) of your SMS, ignoring this parameter routes your messages with your default sender ID

eg. from=My_Company

eco Y | N Optional | Virtual number package only

Select the routing. Using "Y" routes your SMS through low cost economy route. setting value to "N" or ignoring this parameter routes your SMS through Priority route for faster delivery.

reply Y | Phone Number Optional | Virtual number package only

Y - Replies to your sent messages will be forwarded to your registered phone number

Phone Number - forward replies to a given phone number eg. reply=0772823050

(Standard Outgoing rate applies)

url fully qualified url Optional | Virtual number package only

Replies to your sent messages will be posted to the given url in GET method with "from" and "text" parameters.

eg. url=http://www.textit.biz/incomingsmsdemo.php

(free of charge)

for more in-depth integration instructions, download our API Integration Guide


 

 

BALANCE CHECK API

Integration

http://www.textit.biz/creditchk/index.php?id=xxxxxx&pw=xxxx

(Info : textit.biz supports both http and https  | Supports both GET and POST methods) 

Parameters

id = Account Username

pw = Account Password

 

API Response 

Assuming that the Check_Credit routine was executed successfully, the body of the API’s response (i.e. the result) will  contains the credit available on your account. The value is numeric and may contain decimal points.  If the routine failed, the response (i.e the result) will contain the error code. 

 


 

 

 

PHP Example Script

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

$baseurl ="http://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];
}

 

C# Example Script

Use the code 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 and the message respectively

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 ="http://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 example script

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("http://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

 

 

cURL example

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 ="http://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];
}

 

 

 

VB.NET example

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 = "http://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