HTTP API

HTTP(s) API

HTTP API is the most simplest and the scalable method of programming your SMS integration to your website or application. HTTP API can be used for Broadcast (Send SMS Messages) or Check Balance of your account

Download Integration Manual Ver 1.5 (08.09.2017)

Broadcast [SMS]

Integration

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

 

(“text” must be url encoded for reliable delivery.  Use  “+” mark or  “%20” for spaces)


Basic Variables
id     =    <Your Phone Number in international format>
pw   =    <4 Digit Password>
to     =    <Recipients Phone Number in international format>
text   =   <Text Message>

Advanced Integration variables

eco=Y /- Messages will be sent through economy route for very low per SMS cost. Messages will be qued for delivery in fifo basis

reply=Y /- When recipient replies to the SMS, reply will be forwarded to your registered mobile number

reply=[PHONE NUMBER]  When recipient replies to the SMS, reply will be forwarded to the [PHONE NUMBER] phone number

url=<Address of Webpage> – (eg. url=www.textit.biz/example.php) When recipient replies to the SMS, reply will be posted to the web address you specify with GET variables “phone” and “text”

ref=xxx  – this is a pass through variable. the value only shows in your reports and account overview page.

 

API Response
If the routine failed, the first 5 characters of the body will be the word ‘Error’ followed by an error code and/or description.
For example:    Error:to_invalid


If the routine was executed successfully, first 2 characters of the body will be the word ‘OK’ followed by an uniqueMessage Identifier code.

For example:   OK:1234567890-1234

 

 

Balance Check

Integration
http://www.textit.biz/creditchk/index.php?id=xxxxxxxxxx&password=xxxxx

 Variables
id=<Your Phone Number in international format>
pw=<4 Digit Password>

API Response
Assuming that the Balance Check 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.

Scripts

Scripts

$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];
}

Tip : If you get blank response from the api, it may be possible that your hosting provider is blocking external file access.
In such events you should use cURL Script given Below.

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);

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 Scripts [HTTP API]

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];
}

Technical FAQs

Technical

you can use %0a or -NLC- in your message (Please note that this consume 3 and 5 characters from your message)
example 1 : line1%0aline2
example 2 : line1-NLC-line2

It may be possible that your hosting provider is blocking external file access. In such events you should use cURL Script. Copy and past-able script is provided in http://textit.biz/curl_scripts.php

Most of the SMS Integration plugins support textit.biz

One of the easiest to use is Contact Form 7 SMS Integration Plugin

You can generate sms from your website even without an SMS plugin. just generate an Email and use our Email2SMS gateway to convert the email to an SMS

Downloads

Download Integration Manual Ver 1.5 (08.09.2017)