Integration

HTTP API – SMS

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 used to send/receive messages in real-time. It 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.

More info on HTTP(s) API

Integration Guide Ver 1.5 (08.09.17)

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

 

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 = "<a href="http://textit.biz/sendmsg/index.php" data-saferedirecturl="https://www.google.com/url?hl=en&q=http://textit.biz/sendmsg/index.php&source=gmail&ust=1533097235532000&usg=AFQjCNE-hDUCN564WGar1QN05N19LB3zAw">http://textit.biz/sendmsg/index.php</a>"
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

(Replace [id], [pw], with your username and password. Insert recipient number and text message  to [to] and

fields)

Email2SMS

Use email to SMS to send sms notifications, sms reminders, sms alerts or any other type of text message via an email server and our bulk SMS SMTP API.


The Email2SMS is definitely the simplest way of connecting to textit.biz gateway and if you need to overcome a firewall problem, Email2SMS is the best solution.

More info on Email2SMS