CellTrust 2 Way SMS Gateway API (WebServices)
CellTrust Web Services
Web Services enables rapid integration using standard HTTP and SOAP protocols. It provides a secure and technology-independent way of communicating with the CellTrust Multimodal Gateway. Using XML stream and encrypted data, Web Services provides a very reliable, high performance solution. Web Services and XML protocol creates an independent format for data exchange on any type of operating system.
Download
.Net
Sample Project: PM Console.zipPHP Web Services Example
This is an example of using CellTrust Web Services API with PHP. The HTTP API can also be used in conjunction with PHPUsing "sendSMS" Web Service Method With PHP:
<?php
$URN = "urn:notify.soap.primemessage.com";
$WSDL="http://pmgateway.net/pmws/services/TxTMessageService?wsdl";
//SOAP elements (dont edit, and case sensitive!)
$SOAP_ACTION = "sendSMS";
$CTUSERNAME = "Username";
$CTPASSWORD = "Password";
$CTNICKNAME = "nickname";
$DESTINATION = "destination";
$MESSAGE = "message";
$USER_ID = "YourUserID"; //your username at CellTrust
$NICKNAME = "YourNickName"; //your nickname at Celltrust
$PASSWORD = "YourPassword"; //your password at Celltrust
//create user and password SOAP header elements
$UserHdr = new SoapHeader( $URN, $CTUSERNAME, $USER_ID, false);
$PassHdr = new SoapHeader( $URN, $CTPASSWORD, $PASSWORD, false);
//create SOAP body elements, add your destination phone number, and message here
$body = array($CTNICKNAME => $NICKNAME, $DESTINATION=> "18015204567", $MESSAGE => "Test Message");
//create SOAP client
$client = new SoapClient($WSDL, array('trace' => 1, 'exceptions' =>0));
//set SOAP headers
$client->__setSoapHeaders(array($UserHdr, $PassHdr));
//call web service
$result = $client->__call($SOAP_ACTION, $body, NULL);
//check for SOAP error
if (is_soap_fault($result))
{
trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})", E_ERROR);
echo "ERROR\n";
echo $result->faultstring."\n";
}
//very usefull for debug purposes
//show what was requested
var_dump($client->__getLastRequest());
//show gateways response
var_dump($client->__getLastResponse());
?>
$URN = "urn:notify.soap.primemessage.com";
$WSDL="http://pmgateway.net/pmws/services/TxTMessageService?wsdl";
//SOAP elements (dont edit, and case sensitive!)
$SOAP_ACTION = "sendSMS";
$CTUSERNAME = "Username";
$CTPASSWORD = "Password";
$CTNICKNAME = "nickname";
$DESTINATION = "destination";
$MESSAGE = "message";
$USER_ID = "YourUserID"; //your username at CellTrust
$NICKNAME = "YourNickName"; //your nickname at Celltrust
$PASSWORD = "YourPassword"; //your password at Celltrust
//create user and password SOAP header elements
$UserHdr = new SoapHeader( $URN, $CTUSERNAME, $USER_ID, false);
$PassHdr = new SoapHeader( $URN, $CTPASSWORD, $PASSWORD, false);
//create SOAP body elements, add your destination phone number, and message here
$body = array($CTNICKNAME => $NICKNAME, $DESTINATION=> "18015204567", $MESSAGE => "Test Message");
//create SOAP client
$client = new SoapClient($WSDL, array('trace' => 1, 'exceptions' =>0));
//set SOAP headers
$client->__setSoapHeaders(array($UserHdr, $PassHdr));
//call web service
$result = $client->__call($SOAP_ACTION, $body, NULL);
//check for SOAP error
if (is_soap_fault($result))
{
trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})", E_ERROR);
echo "ERROR\n";
echo $result->faultstring."\n";
}
//very usefull for debug purposes
//show what was requested
var_dump($client->__getLastRequest());
//show gateways response
var_dump($client->__getLastResponse());
?>
Using Send Message Web Service Method With PHP:
<?php
$URN = "urn:notify.soap.primemessage.com";
$WSDL="http://pmgateway.net/pmws/services/TxTMessageService?wsdl";
$encoding = SOAP_DEFAULT_ENCODING;
//SOAP elements (dont edit, and case sensitive!)
$SOAP_ACTION = "sendMessage";
$CTUSERNAME = "Username";
$CTPASSWORD = "Password";
$CTNICKNAME = "nickname";
$DESTINATION = "destination";
$MESSAGE = "message";
$RECIPIENT = "recipients";
$ADMINEMAIL = "adminEmail";
$SUBJECT = "subject";
$USER_ID = "YourUserID"; //your username at CellTrust
$NICKNAME = "YourNickName"; //your nickname at Celltrust
$PASSWORD = "YourPassword"; //your password at Celltrust
$EMAILADDRESS = "You@YourDomain.Com"; //email address where you would like a summary sent
//create user and password SOAP header elements
$UserHdr = new SoapHeader( $URN, $CTUSERNAME, $USER_ID, false);
$PassHdr = new SoapHeader( $URN, $CTPASSWORD, $PASSWORD, false);
//create SOAP body elements, add your destination phone number, and message here
$dialstring = array(array("deliveryType" => 0, "destination" => "14806490123", "firstName" => "John", "lastName" => "Doe"));
$bodymulti = array($CTNICKNAME => $NICKNAME, $MESSAGE => "Test SMS Message", $SUBJECT => "Test SMS Message Sent ", $RECIPIENT => $dialstring, $ADMINEMAIL = $EMAILADDRESS);
//create SOAP client
$client = new SoapClient($WSDL, array('trace' => 1, 'exceptions' =>0));
//set SOAP headers
$client->__setSoapHeaders(array($UserHdr, $PassHdr));
//call web service single sms
$result = $client->__call($SOAP_ACTION, $bodymulti, NULL);
//very usefull for debug purposes
//show what was requested
var_dump($client->__getLastRequest());
//show gateways response
var_dump($client->__getLastResponse());
?>