Easily integrate with our API.

To quickly test single or basic multiple messages via our API when using a user name and password, choose to generate either a GET or POST request, then simply change the fields below highlighted in red to your relevant information.

Or, for those that wish to integrate or test using an API-key, please click the button below to view the example code when programming for our API-key.

  • https://faretext-api.co.uk:9443/api?action=sendmessage&username=USERNAME&password=PASSWORD&recipient=447xxxxxxxxx&originator=SENDERID
    &messagedata=MESSAGE

  • https://faretext-api.co.uk:9443/api?action=sendmessage&username=USERNAME&password=PASSWORD&originator=SENDERID&recipient=447xxxxxxxxx;
    447xxxxxxxxx&messagedata=MESSAGE

  • <form action=https://faretext-api.co.uk:9443/api method=post><br>
    action: <input type=text name=action value=sendmessage><br>
    username: <input type=text name=username value=USERNAME><br>
    password: <input type=text name=password value=PASSWORD><br>
    originator: <input type=text name=originator value=SENDERID><br>
    recipient: <input type=text name=recipient value=447xxxxxxxxx><br>
    messagedata: <input type=text name=messagedata value=’MESSAGE‘><br>
    <input type=submit value=OK>
    </form>

  • <form action=https://faretext-api.co.uk:9443/api method=post><br>
    action: <input type=text name=action value=sendmessage><br>
    username: <input type=text name=username value=USERNAME><br>
    password: <input type=text name=password value=PASSWORD><br>
    originator: <input type=text name=originator value=SENDERID><br>
    recipient: <input type=text name=recipient value=447xxxxxxxxx;447xxxxxxxxx><br>
    messagedata: <input type=text name=messagedata value=’MESSAGE’><br>
    <input type=submit value=OK>
    </form>

Our SMS API is multilingual.

For simple but effective integration, identify your preferred programming language in the list below and expand. Choose between a GET or POST request. Copy the example code, replacing the required fields with your account credentials and personalised message details, then paste directly into your software, application or website to test.

Mandatory and optional parameters can be viewed by clicking the ‘show parameters’ button.

  • ASP
    • <%
            address = "https://faretext-api.co.uk:9443/api?action=sendmessage"
            username = "your_username"
            password = "your_password"
            originator = "your_originator/senderid"
            messagedata = "Hello this is a test from Faretext"
            messagedata = Server.urlencode(messagedata)
            recipient = "telephone_number"
            url = address & "&username=" & username & "&password=" & password & "&originator=" & originator & "&messagedata=" & messagedata & "&recipient=" & recipient
            set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
            xmlhttp.open "GET", url, false
            xmlhttp.send ""
            msg = xmlhttp.responseText
            response.write(msg)
            set xmlhttp = nothing
      %>
    • <%
            address = "https://faretext-api.co.uk:9443/api?action=sendmessage"
            username = "your_username"
            password = "your_password"
            originator = "your_originator/senderid"
            messagedata = "Hello this is a test from Faretext"
            messagedata = Server.urlencode(messagedata)
            recipient = "telephone_number"
            url = address & "&username=" & username & "&password=" & password & "&originator=" & originator & "&messagedata=" & messagedata & "&recipient=" & recipient
            set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
            xmlhttp.open "POST", url, false
            xmlhttp.send ""
            msg = xmlhttp.responseText
            response.write(msg)
            set xmlhttp = nothing
      %>
  • ASP.NET
    • <%@ Import Namespace="System.Net" %>
      <%@ Import Namespace="System.IO" %>
      
      <script runat="server" language="VB">
      
          Sub Page_Load(sender As Object, e As EventArgs)
              Dim Username As String = "your_username"
              Dim Password As String = "your_password"
              Dim Originator As String = "your_originator/senderid"
              Dim Recipient As String = "telephone_number"
              Dim MessageData As String = "Hello this is a test from Faretext"
      
              Dim URL As String = "https://faretext-api.co.uk:9443/api?action=sendmessage&Username=" & Username & "&Password=" & Password & "&Originator=" & Originator & "&Recipient =" &Recipient & "&MessageData=" & MessageData
      
      Dim req As HttpWebRequest = WebRequest.Create(URL)
      
              Try
                  Dim resp As HttpWebResponse = req.GetResponse()
                  Dim sr As New StreamReader(resp.GetResponseStream())
                  Dim results As String = sr.ReadToEnd()
                  sr.Close()
      
                  html.Text = results
              Catch wex As WebException
              Response.Write("ERROR!
      Status: " & wex.Status & "Message: " & wex.Message & "")
              End Try
          End Sub
      
      </script>
    • <%@ Import Namespace="System.Net" %>
      <%@ Import Namespace="System.IO" %>
      
      <script runat="server" language="VB">
      
          Sub Page_Load(sender As Object, e As EventArgs)
              Dim Username As String = "your_username"
              Dim Password As String = "your_password"
              Dim Originator As String = "your_originator/senderid"
              Dim Recipient As String = "telephone_number"
              Dim MessageData As String = "Hello this is a test from Faretext"
              Dim URL As String = "https://faretext-api.co.uk:9443/api?action=sendmessage"
              Dim PostData As String = "&Username=" & Username & "&Password=" & Password & "&Originator=" & Originator & "&Recipient=" & Recipient & "&MessageData=" & MessageData
      
              Dim req As HttpWebRequest = WebRequest.Create(URL)
              req.Method = "POST"
              Dim encoding As New ASCIIEncoding()
              Dim byte1 As Byte() = encoding.GetBytes(PostData)
              req.ContentType = "application/x-www-form-urlencoded"
              req.ContentLength = byte1.Length
              Dim newStream As Stream = req.GetRequestStream()
              newStream.Write(byte1, 0, byte1.Length)
      
              Try
      
                  Dim resp As HttpWebResponse = req.GetResponse()
                  Dim sr As New StreamReader(resp.GetResponseStream())
                  Dim results As String = sr.ReadToEnd()
                  sr.Close()
                  html.Text = results
              Catch wex As WebException
              Response.Write("ERROR!
      Status: " & wex.Status & "Message: " & wex.Message & "")
              End Try
          End Sub
      
      </script>
  • C#
    • using System;
      using System.Collections.Generic;
      using System.Net;
      using System.Collections.Specialized;
      
      namespace send
      {
          class send
          {
              public string send()
              {
                  String MessageData = HttpUtility.UrlEncode("Hello this is a test from Faretext");
                  using (var wb = new WebClient())
                  {
                      byte[] response = wb.UploadValues("https://faretext-api.co.uk:9443/api?action=sendmessage", new NameValueCollection()
                      {
                      {"Username" , "your_username"},
                      {"Password" , "your_password"},
                      {"Originator" , "your_originator/senderid"}
                      {"Recipient" , "telephone_number"},
                      {"MessageData" , MessageData},
                      });
                      string result = System.Text.Encoding.UTF8.GetString(response);
                      return result;
                  }
              }
          }
      }
    • using System;
      using System.Collections.Generic;
      using System.Net;
      using System.Collections.Specialized;
      using System.IO;
      
      namespace send
      {
      class send
      {
      public string send()
      {
      String result;
      string Username = "your_username";
      string Password = "your_password";
      string Originator = "your_originator/senderid";
      string Recipient = "telephone_number";
      string MessageData = "Hello this is a test from Faretext";
      
      String url = “https://faretext-api.co.uk:9443/api?action=sendmessage&Username” + Username + "&Password=" + Password + "&Originator=" + Originator + "&Recipient=" + Recipient + "&MessageData=" + MessageData;
      
      StreamWriter myWriter = null;
      		HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
      
      objRequest.Method = "POST";
      		objRequest.ContentLength = Encoding.UTF8.GetByteCount(url);
      		objRequest.ContentType = "application/x-www-form-urlencoded";
      		try
      		{
      			myWriter = new StreamWriter(objRequest.GetRequestStream());
      			myWriter.Write(url);
      		}
      		catch (Exception e)
      		{
      			return e.Message;
      		}
      finally
      		{
      			myWriter.Close();
      		}
      
      HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
      		using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
      		{
      			result = sr.ReadToEnd();
      			sr.Close();
      		}
      		return result;
      		}
      	}
      }
  • Delphi
    • function Send(Username, Password , Originator, Recipient,
            MessageData: String):string;
          const
            URL = 'https://faretext-api.co.uk:9443/api?action=sendmessage&Username=%s&Password=%s&Originator=%s&Recipient=%s&MessageData=%s';
            ResponseSize = 1024;
          var
            hSession, hURL: HInternet;
            Request: String;
            ResponseLength: Cardinal;
          begin
            hSession := InternetOpen('DrBob42', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
            try
              Request := Format(URL,[Username,Password,Originator,Recipient,HttpEncode(MessageData)]);
              hURL := InternetOpenURL(hSession, PChar(Request), nil, 0,0,0);
              try
                SetLength(Result, ResponseSize);
                InternetReadFile(hURL, PChar(Result), ResponseSize,
                  ResponseLength);
                SetLength(Result, ResponseLength)
              finally
                InternetCloseHandle(hURL)
              end
            finally
              InternetCloseHandle(hSession)
            end
          end;
    • function send(const Url: string): string;
      var
        NetHandle: HINTERNET;
        UrlHandle: HINTERNET;
        Buffer: array[0..1024] of Char;
        BytesRead: dWord;
      begin
        Result := '';
        NetHandle := InternetOpen('Delphi 5.x', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
        if Assigned(NetHandle) then
        begin
          UrlHandle := InternetOpenUrl(NetHandle, PChar(Url), nil, 0, INTERNET_FLAG_RELOAD, 0);
          if Assigned(UrlHandle) then
            { UrlHandle valid? Proceed with download }
          begin
            FillChar(Buffer, SizeOf(Buffer), 0);
            repeat
              Result := Result + Buffer;
              FillChar(Buffer, SizeOf(Buffer), 0);
              InternetReadFile(UrlHandle, @Buffer, SizeOf(Buffer), BytesRead);
            until BytesRead = 0;
            InternetCloseHandle(UrlHandle);
          end
          else
            { UrlHandle is not valid. Raise an exception. }
            raise Exception.CreateFmt('Error: Cannot open URL %s', [Url]);
          InternetCloseHandle(NetHandle);
        end
        else
          { NetHandle is not valid. Raise an exception }
          raise Exception.Create('Error:');
      end;
        url := 'https://faretext-api.co.uk:9443/api?action=sendmessage' + '&Username=your_username' +'&Password=your_password' +  '&Originator=your_originator/senderid' + '&Recipient=telephone_number' + '&MessageData=Hello+this+is+a+test+from+Faretext';
        send(url);
  • Java
    • import java.io.BufferedReader;
      import java.io.InputStreamReader;
      import java.io.OutputStreamWriter;
      import java.net.URL;
      import java.net.URLConnection;
      import java.net.URLEncoder;
      
      public class send {
      	public String send() {
      		try {
      String Username = "&Username=" + URLEncoder.encode("your_username", "UTF-8");
      String Password = "&Password=" + URLEncoder.encode("your_password", "UTF-8");
      String Originator = "&Originator=" + URLEncoder.encode("your_originator/senderid", "UTF-8");
      String Recipient = "&Recipient=" + URLEncoder.encode("telephone_number", "UTF-8");
      String MessageData = "&MessageData=" + URLEncoder.encode("Hello this is a test from Faretext", "UTF-8");
      
      String data = "https://faretext-api.co.uk:9443/api?action=sendmessage " + Username + Password + Originator + Recipient + MessageData;
      			URL url = new URL(data);
      			URLConnection conn = url.openConnection();
      			conn.setDoOutput(true);
      
      			BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
      			String line;
      			String sResult="";
      			while ((line = rd.readLine()) != null) {
      				sResult=sResult+line+" ";
      			}
      			rd.close();
      
      			return sResult;
      		} catch (Exception e) {
      			System.out.println("Error:"+e);
      			return "Error:"+e;
      		}
      	}
      }
    • import java.io.BufferedReader;
      import java.io.InputStreamReader;
      import java.io.OutputStreamWriter;
      import java.net.URL;
      import java.net.URLConnection;
      import java.net.URLEncoder;
      
      public class send {
      	public String send() {
      		try {
      			
      			String Username = "&Username=" + "your_username";
      			String Password = "&Password=" + "your_password";
      			String Originator = "&Originator=" + "your_originator/senderid";
      			String Recipient = "&Recipient=" + "telephone_number";
      			String MessageData = "&MessageData=" + "Hello this is a test from Faretext";
      
      			
      			HttpURLConnection conn = (HttpURLConnection) new URL("https://faretext-api.co.uk:9443/api?action=sendmessage").openConnection();
      			String data = Username + Password + Originator + Recipient + MessageData;
      			conn.setDoOutput(true);
      			conn.setRequestMethod("POST");
      			conn.setRequestProperty("Content-Length", Integer.toString(data.length()));
      			conn.getOutputStream().write(data.getBytes("UTF-8"));
      			final BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
      			final StringBuffer stringBuffer = new StringBuffer();
      			String line;
      			while ((line = rd.readLine()) != null) {
      				stringBuffer.append(line);
      			}
      			rd.close();
      
      			return stringBuffer.toString();
      		} catch (Exception e) {
      			System.out.println("Error"+e);
      			return "Error"+e;
      		}
      	}
      }
      
      
  • Perl
    • use LWP::Simple;
      
      my $Username = "&Username=" . 'your_username';
      my $Password = "&Password=" . 'your_password';
      my $Originator = "&Orginator=" . "your_originator/senderid";
      my $Recipient = "&Recipient=" . "telephone_number";
      my $MessageData = "&MessageData=" . " Hello+this+is+a+test+from+Faretext";
      
      my $String = join "", "https://faretext-api.co.uk:9443/api?action=sendmessage", $Username, $Password, $Originator, $Recipient, $MessageData;
      my $URL = get($String);
      print "$URL";
      
      
    • use strict;
      use LWP::UserAgent;
      use HTTP::Request::Common;
      
      
      my $Username = "&Username=" . 'your_username';
      my $Password = "&Password=" . 'your_password';
      my $Originator = "&Orginator=" . "your_originator/senderid";
      my $Recipient = "&Recipient=" . "telephone_number";
      my $MessageData = "&MessageData=" . "Hello this is a test from Faretext";
      my $send = LWP::UserAgent->new();
      
      my $url = $send->request
      (
       POST 'https://faretext-api.co.uk:9443/api?action=sendmessage',
       Content_Type  => 'application/x-www-form-urlencoded',
       Content       => [
      		'Username' => $Username,
      		'Password' => $Password,
      		'Originator' => $Originator,
      		'Recipient' => $Recipient,
      		'MessageData' => $MessageData
      		]
      );
      
      
      if ($url->is_error) { die "HTTP: Error"; }
      print "Response:nn" . $url->content . "nn";
  • PHP
    • <?php
      	$Username = urlencode('your_username');
      	$Password = urlencode('your_password');
      	$Originator = urlencode('your_originator/senderid');
      	$Recipient = urlencode('telephone_number');
      	$MessageData = rawurlencode('Hello this is a test from Faretext');
      
      	$smsdata = '&Username=' . $Username. '&Password=' . $Password. '&Originator=' . $Originator. "&Recipient=" . $Recipient. "&MessageData=" . $MessageData;
      
      	$ch = curl_init('https://faretext-api.co.uk:9443/api?action=sendmessage' . $smsdata);
      	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      	$response = curl_exec($ch);
      	curl_close($ch);
      
      
      	echo $response;
      ?>
    • <?php
      	$Username = urlencode('your_username');
      	$Password = urlencode('your_password');
      	$Originator = urlencode('your_originator/senderid');
      	$Recipient = urlencode('telephone_number');
      	$MessageData = rawurlencode('Hello this is a test from Faretext');
      
      	$smsdata = array('&Username=' . $Username. '&Password=' . $Password. '&Originator=' . $Originator. "&Recipient=" . $Recipient. "&MessageData=" . $MessageData);
      
      	$ch = curl_init('https://faretext-api.co.uk:9443/api?action=sendmessage');
      	curl_setopt($ch, CURLOPT_POST, true);
      	curl_setopt($ch, CURLOPT_POSTFIELDS, $smsdata);
      	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      	$response = curl_exec($ch);
      	curl_close($ch);
      
      	echo $response;
      ?>
      
      
  • Python
    • import urllib.request
      import urllib.parse
      
      def send(Username, Password, Originator, Recipient, MessageData):
          params = {'Username': your_username, 'Password': your_password,  'Originator': your_originator/senderid, 'Recipient' : telephone_number, 'MessageData': MessageData}
          f = urllib.request.urlopen('https://faretext-api.co.uk:9443/api?action=sendmessage'
              + urllib.parse.urlencode(params))
          return (f.read(), f.code)
      
      resp, code = send('your_username', 'your_password', 'your_originator/senderid', 'telephone_number', 'Hello this is a test from Faretext')
      print (resp)
    • import urllib.request
      import urllib.parse
      
      def send(Username, Password, Originator, Recipient, MessageData):
          data =  urllib.parse.urlencode({'Username': your_username, 'Password': your_password,  'Originator': your_originator/senderid, 'Recipient': telephone_number, 'MessageData': MessageData})
          data = data.encode('utf-8')
          request = urllib.request.Request("https://faretext-api.co.uk:9443/api?action=sendmessage")
          f = urllib.request.urlopen(request, data)
          fr = f.read()
          return(fr)
      
      resp =  send('your_username', 'your_password', 'your_originator/senderid', 'telephone_number', 'Hello this is a test from Faretext')
      print (resp)
      
      
  • Ruby
    • require "rubygems"
      require "net/https"
      require "uri"
      require "json"
      
      Username = "your_username"
      Password = "your_password"
      Originator = "your_originator/senderid"
      Recipient = "telephone_number"
      MessageData = "Hello this is a test from Faretext"
      
      requested_url = 'https://faretext-api.co.uk:9443/api?action=sendmessage' + "&Username=" + Username + "&Password=" + Password + "&Originator=" + Originator + "&Recipient=" + Recipient "&MessageData=" + URI.escape(MessageData)
      
      uri = URI.parse(requested_url)
      http = Net::HTTP.start(uri.host, uri.port)
      request = Net::HTTP::Get.new(uri.request_uri)
      
      res = http.request(request)
      response = JSON.parse(res.body)
      puts (response)

       

    • require "rubygems"
      require "net/https"
      require "uri"
      require "json"
      
      requested_url = 'https://faretext-api.co.uk:9443/api?action=sendmessage'
      
      uri = URI.parse(requested_url)
      http = Net::HTTP.start(uri.host, uri.port)
      request = Net::HTTP::Get.new(uri.request_uri)
      
      res = Net::HTTP.post_form(uri, 'Username' => 'your_username', 'Password' => 'your_password', 'Originator' => 'your_originator/senderid', 'Recipient' => 'telephone_number', 'MessageData' => 'Hello this is a test from Faretext')
      response = JSON.parse(res.body)
      puts (response)
      
      
  • VBA
    • Public Sub Send()
      	Dim Username As String
      	Username = "&Username=" + "your_username"
      	Dim Password As String
      	Password = "&Password=" + "your_password"
      	Dim Originator As String
      	Originator = "&Originator=" + "your_originator/senderid"
      	Dim Recipient As String
      	Recipient = "&Recipient=" + "telephone_number"
      	MessageData As String
      	MessageData = "&MessageData=" + "Hello this is a test from Faretext"
      
      Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
      	MyRequest.Open "GET", "https://faretext-api.co.uk:9443/api?action=sendmessage" + Username + Password + Originator + Recipient + MessageData 
      	MyRequest.Send
      	MsgBox MyRequest.ResponseText
      End Sub
    • Public Sub Send()
      	Dim Username As String
      	Dim Password As String
      	Dim Originator As String
      	Dim Recipient As String
      	Dim MessageData As String
      	Dim URL As String
      	Dim postData As String
      	Dim winHttpReq As Object
      	Username = "your_username"
      	Password = "your_password"
      	Originator = "your_originator/senderid"
      	Recipient = "telephone_number"
      	MessageData = "Hello this is a test from Faretext"
      	URL = "https://faretext-api.co.uk:9443/api?action=sendmessage"
      
      Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
      	postData = "&Username=" + Username + "&Password=" + Password + "&Originator=" + Originator "&Recipient=" + Recipient + "&MessageData=" + MessageData
      
      winHttpReq.Open "POST", myURL, False
      	winHttpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
      	winHttpReq.Send (postData)
      
      	SendSMS = winHttpReq.responseText
      End Sub

       

  • VBA.NET
    • Imports System.Net
      Imports System.Web
      Imports System.Collections.Specialized
      Imports System.IO
      Imports System.Text
      
      Public Class send
      
          Public Function send()
      
              Dim Username = "your_username"
              Dim Password = "your_password"
              Dim Originator = "your_originator/senderid"
              Dim Recipient = "telephone_number"
              Dim Messagedata = "Hello this is a test from Faretext"
              Dim strGet As String
              Dim url As String = "https://faretext-api.co.uk:9443/api?action=sendmessage"
      
       strGet = url + "&Username=" + Username _
              + "&Password=" + Password _
              + "&Originator=" + Originator _
              + "&Recipient=" + Recipient _
              + "&MessageData=" + WebUtility.UrlEncode(MessageData) 
      
      Dim webClient As New System.Net.WebClient
              Dim result As String = webClient.DownloadString(strGet)
              Console.WriteLine(result)
              Return result
          End Function
      End Class
    • Imports System.Web
      Imports System.IO
      Imports System.Net
      Imports System.Text
      Imports System.Resources
      
      Public Class send
      
      Public Function send()
              Dim Username = "your_username"
              Dim Password = "your_password"
              Dim Originator = "your_originator/senderid"
              Dim Recipient = "telephone_number"
              Dim Messagedata = "Hello this is a test from Faretext"
              Dim strPost As String
              Dim url As String = "https://faretext-api.co.uk:9443/api?action=sendmessage"
      
              strPost = url + "&Username=" + Username _
              + "&Password=" + Password _
              + "&Originator=" + Originator _
              + "&Recipient=" + Recipient _
              + "&MessageData=" + WebUtility.UrlEncode(MessageData) 
      
              Dim request As WebRequest = WebRequest.Create(strPost)
              request.Method = "POST"
              Dim byteArray As Byte() = Encoding.UTF8.GetBytes(strPost)
              request.ContentType = "application/x-www-form-urlencoded"
              request.ContentLength = byteArray.Length
              Dim dataStream As Stream = request.GetRequestStream()
              dataStream.Write(byteArray, 0, byteArray.Length)
              dataStream.Close()
              
             Dim response As WebResponse = request.GetResponse()
              dataStream = response.GetResponseStream()
              Dim reader As New StreamReader(dataStream)
              Dim responseFromServer As String = reader.ReadToEnd()
              Console.WriteLine(responseFromServer)
              Console.ReadLine()
              
              reader.Close()
              dataStream.Close()
              response.Close()
              
             If responseFromServer.Length > 0 Then
                  Return responseFromServer
              Else
                  Return CType(response, HttpWebResponse).StatusDescription
              End If
          End Function
      End Class
      
      
      
      
      
      
  • VB6
    • Private Sub send()
      
          Dim DataToSend As String
          Dim objXML As Object
          Dim Messagedata As String
          Dim Username As String
          Dim Password As String
          Dim Recipient As String
          Dim Originator As String
          Dim URL As String
      
      Username = "your_username";
      Password = "your_password";
      Originator = "your_originator/senderid"
      Recipient = "telephone_number"
      URL = "http://faretext-api.co.uk:9501/api?action=sendmessage"
      
      Messagedata = URLEncode("Hello this is a test from Faretext")
      
      Set objXML = CreateObject("Microsoft.XMLHTTP")
      objXML.Open "POST", URL , False
      objXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
      
      objXML.send "&Username=" + Username + "&Password=" + Password +"&Recipient=" + Recipient + "&Messagedata=" + Messagedata + "&Originator=" + Originator
      
      
      If Len(objXML.responseText) > 0 Then
              MsgBox objXML.responseText
      End If
      
      End Sub
      
      Function URLEncode(ByVal Text As String) As String
          Dim i As Integer
          Dim acode As Integer
          Dim char As String
      
          URLEncode = Text
      
          For i = Len(URLEncode) To 1 Step -1
              acode = Asc(Mid$(URLEncode, i, 1))
              Select Case acode
                  Case 48 To 57, 65 To 90, 97 To 122
                  Case 32
                      Mid$(URLEncode, i, 1) = "+"
                  Case Else
                      URLEncode = Left$(URLEncode, i - 1) & "%" & Hex$(acode) & Mid$ _
                          (URLEncode, i + 1)
              End Select
          Next
      
      End Function
      
      
      
      
      
    • Private Sub send()
      
          Dim DataToSend As String
          Dim objXML As Object
          Dim Messagedata As String
          Dim Username As String
          Dim Password As String
          Dim Recipient As String
          Dim Originator As String
          Dim URL As String
      
      Username = "your_username";
      Password = "your_password";
      Originator = "your_originator/senderid"
      Recipient = "telephone_number"
      URL = "http://faretext-api.co.uk:9501/api?action=sendmessage"
      
      Messagedata = URLEncode("Hello this is a test from Faretext")
      
      Set objXML = CreateObject("Microsoft.XMLHTTP")
      objXML.Open "POST", URL , False
      objXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
      
      objXML.send "&Username=" + Username + "&Password=" + Password +"&Recipient=" + Recipient + "&Messagedata=" + Messagedata + "&Originator=" + Originator
      
      
      If Len(objXML.responseText) > 0 Then
              MsgBox objXML.responseText
      End If
      
      End Sub
      
      Function URLEncode(ByVal Text As String) As String
          Dim i As Integer
          Dim acode As Integer
          Dim char As String
      
          URLEncode = Text
      
          For i = Len(URLEncode) To 1 Step -1
              acode = Asc(Mid$(URLEncode, i, 1))
              Select Case acode
                  Case 48 To 57, 65 To 90, 97 To 122
                  Case 32
                      Mid$(URLEncode, i, 1) = "+"
                  Case Else
                      URLEncode = Left$(URLEncode, i - 1) & "%" & Hex$(acode) & Mid$ _
                          (URLEncode, i + 1)
              End Select
          Next
      
      End Function
      
      
      
      
      
  • Mandatory Parameters


    Parameter
    Description
    Possible values
    Example
    action
    Specifies the HTTPs API command
    sendmessage
    action=sendmessage
    username
    Specifies the username. The username and password parameters are used to authenticate the user. When you send an message it will be sent in the name of the authenticated user. The value must be urlencoded.
    string value, maximum length is 16 characters
    username=USERNAME
    password
    Specifies the password. The username and password parameters are used to authenticate the user. When you send a message it will be sent in the name of the authenticated user. The value must be urlencoded.
    string value, maximum length is 16 characters
    password=PASSWORD
    recipient
    Specifies the recipient phone number. The message will be sent to this telephone number. The telephone number can be specified in local number format (e.g.077421234567), or in international number format (e.g.+4477421234567). More then one recipient addresses can be separated by a colon (e.g.: +4477421234567,+447422222222) The value must be urlencoded.
    string value, maximum length is 16 characters
    recipient=447xxxxxxxxx
    messagedata
    Specifies the text or the data of the SMS message. The value must be encoded in UTF8 and must be urlencoded.
    string value, maximum length is 32768 characters
    messagedata=MESSAGE

    Optional Parameters


    Parameter
    Description
    Possible values
    Example
    originator
    Specifies the sender address. This information will be displayed on the mobile phone, that receives the message. This is the sender address. This can be a telephone number, a short code or an alphanumeric sender address. The telephone number must can be formatted in local number format (e.g.077421234567), or in international number format (e.g.+4477421234567). If you use an alphanumeric sender address (e.g.FareText), the characters must be encoded in UTF8 and the value must be urlencoded.
    string value, maximum length is 16 characters. NOTE: UK Network support up to 11 characters.
    originator=SENDERID
    sendondate
    Specifies the date and time, when the message should be sent. The value must use the following date format: YYYY-MM-DD hh:mm:ss. The value must be url encoded.
    date value in YYYY-MM-DD hh:mm:ss format
    sendondate=2020-12-31%2021:00:00 - Example will send a message on 31st December 2020 at 21:00
    responseformat
    After the gateway submits the SMS message, the gateway will return a web page indicating that the message was submitted successfully. The content of the webpage is formatted according to the responseformat parameter. You can have html text response to make it easy for humans to read it or you can have xml format to make it easy for software to process the response.
    xml (default) html urlencoded
    responseformat=xml
    reporturl
    You can setup a webpage to process information about “delivered to network” and “delivered to handset”events. If you specify an URL in the reporturl parameter, your webpage will be called when these events happen. The value of the URL you specify in the reporturl parameter must be urlencoded. The URL you specify can contain keywords that will be replaced to state information corresponding to the submitted message. More information about possible keywords can be found in the “Submit URL keywords” guide. Please also note, that if you want the reporturl parameter to work, you must create a “HTTPs server user” account and use it’s username and password. The “Standard user” account does not support this option.
    string value, maximum length is 1024 characters
    reporturl=http://www.Domain. com/SMS.php? reporttype= $reporttype&messageid= $messageid) Note: this is the urlencoded version of the following URL. Before this URL is called by the SMS gateway, the $reporttype and $messageid parameters will be replaced to the appropriate values: reporturl=http%3A%2F%2F www.domain.com %2Fsms.php%3Freporttype %3D%24reporttype %26messageid%3D% 24messageid will be called as: http://www.Domain.com/SMS. php?reporttype=deliveredtohandset &messageid=e99549d4-65f7- 435d-ba19-de6b851801ce

Can’t see your programming language? Please get in touch by using the form at the bottom of the page.