Textit.biz Serving Sri Lanka since 2011.
$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];
}
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];
}
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);
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
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