Affiliate Login
Swift SMS Gateway logo

.Net Languages - Specific Instructions

 Using SOAP web services in the .Net framework is extremely simple. First, add a web reference to your project which points to the above URL. All of the necessary code for parsing messages and responses will be added to the project. Sending an SMS message then consists of two lines of code: (assuming the required imports or using statements are present)

SendSMS SMSMessenger = new SendSMS();
result = SMSMessenger.SendMessage(CellNumber, MessageBody, AccountKey);

If you prefer to use REST and JSON in .Net rather than Soap and XML, you can use the WebClient class and a JSON deserializer such as JSON. Net to do the following:

string url = string.Format("{1}/{0}", recipientCellNumber, accountKey);

var serviceRequest = new WebClient();
serviceRequest.Headers[HttpRequestHeader.ContentType] = "application/JSON";

string jsonStringParams = string.Format("{{\"MessageBody\":\"{0}\",\"Reference\":\"{1}\"}}", messageBody, reference);

var response = serviceRequest.UploadString(url, "POST", jsonStringParams);
var jsonObject = JObject.Parse(response);
string response = (string) jsonObject["SendMessageWithReferenceResult"];

Download Samples (.Net Framework 2.0, Visual Studio 2005)

Download Samples (.Net Framework 4.5, Visual Studio 2012)

PHP - Specific instructions and Samples

PHP 5 SOAP Module Sample Code (Requires installation of the SOAP Module)

class SMSParam {
    public $CellNumber;
    public $AccountKey;
    public $MessageBody;

$client = new SoapClient('');
$parameters = new SMSParam;

$parameters -> CellNumber = "212-555-1212";
$parameters -> AccountKey = "GSP1234567";
$parameters -> MessageBody = "This is a demonstration of using PHP5.";

$Result = $client->SendMessage($parameters);

Download Samples

  • PHP Samples - Includes samples using NuSoap and the SOAP module in PHP 5. Please note that we do not recommend the NuSoap library for our more advanced functions, as the handling of arrays in NuSoap is not compatible with the latest SOAP standard.

Legacy Microsoft Languages - Instructions and samples

We strongly recommend making using of the free Microsoft SOAP Toolkit. This toolkit contains a COM object which allows you to make SOAP calls in three simple steps.
  1. First, create an instance of an MSSoap.SoapClient30 object.
  2. Initialize the instance by calling the mssoapinit method and passing in the URL of the webservice.
  3. Call the SendMessage or SendMessageWithReference method on the object.

Here is an example in Visual Basic 6:

Set SMSMessenger = CreateObject("MSSoap.SoapClient30")
Call SMSMessenger.mssoapinit("")
Dim result As String
result = SMSMessenger.SendMessage(CellNumber, MessageBody, AccountKey)

The SOAP Toolkit 3.0 can be downloaded here

Download Samples

© 2015 Swift SMS Gateway Inc.