Table of Contents [Hide/Show]
File SMSMessage.php File SendSingleMessage.php File SMSService.php File Test.php
<?php /** * * * @package * @copyright */ class SMSMessage { /* string */ public $ReceiverNumber; /* string */ public $SenderNumber; /* string */ public $Text; /* string */ public $Network; /* string */ public $TypeOfMessage; /* int */ public $Tariff; /* int */ public $TimeToLive; /* string */ public $CPATag; /* boolean */ public $RequestReceipt; /* string */ public $SessionData; /* string */ public $AffiliateProgram; /* string */ public $DeliveryTime; } ?>
<?php /** * * * @package * @copyright */ class SendSingleMessage { /* string */ public $username; /* string */ public $password; /* SMSMessage */ public $m; } ?>
<?php /** * SMSService class file * * @author {author} * @copyright {copyright} * @package {package} */ /** * SendSingleMessage class */ require_once 'SendSingleMessage.php'; /** * SMSMessage class */ require_once 'SMSMessage.php'; /** * SMSService class * * PSWinCom SMS Gateway SOAP Interface * * @author {author} * @copyright {copyright} * @package {package} */ class SMSService extends SoapClient { public function SMSService($wsdl = "http://sms.pswin.com/SOAP/SMS.asmx?wsdl", $options = array()) { parent::__construct($wsdl, $options); } /** * * * @param SendSingleMessage $parameters * @return SendSingleMessageResponse */ public function SendSingleMessage(SendSingleMessage $parameters) { return $this->__call('SendSingleMessage', array( new SoapParam($parameters, 'parameters') ), array( 'uri' => 'http://pswin.com/SOAP/Submit/SMS', 'soapaction' => '' ) ); } } ?>
<?php require_once('SMSService.php'); // Create a new message $objMessage = new SMSMessage(); $objMessage->ReceiverNumber ='(receiver number including countrycode)'; $objMessage->SenderNumber = 'PSWinCom'; $objMessage->Text = 'Test message'; $objMessage->Tariff = 0; $objMessage->TimeToLive = 0; $objMessage->RequestReceipt = false; // Create parameters $objSendSingleMessage = new SendSingleMessage(); $objSendSingleMessage->m = $objMessage; $objSendSingleMessage->username = '(username)'; $objSendSingleMessage->password = '(password)'; // Connect to service $objService = new SMSService(); // Send message $objReturn = $objService->SendSingleMessage($objSendSingleMessage); echo '<pre>'; var_dump($objReturn); echo '</pre>'; ?>