Sample - PHP

Web Service

Connecting to the Web Service from PHP can be accomplished using the SoapClient class included with PHP version 5 and later:

$sc = new SoapClient('http://www.textapp.net/webservice/service.asmx?wsdl'); $params = new stdClass(); $params->returnCSVString = false; $params->externalLogin = 'mylogin'; $params->password = 'mypassword'; $params->clientBillingReference = 'myclientbillingreference'; $params->clientMessageReference = 'myclientmessagereference'; $params->originator = 'mynumber'; $params->destinations = '+447912345678'; $params->body = utf8_encode('hello world'); $params->validity = 72; $params->characterSetID = 2; $params->replyMethodID = 4; $params->replyData = ''; $params->statusNotificationUrl = ''; $result = $sc->__call('SendSMS', array($params)); echo $result->SendSMSResult;

You can call any of the Web Service methods in a similar manner. When using different methods be sure to change the highlighted text to match the name of the method you are calling. You can specify a proxy server if required:

$proxy = array( 'proxy_host' => 'my.proxy.host', 'proxy_port' => '8080', 'proxy_login' => 'myproxyusername', 'proxy_password' => 'myproxypassword'); $sc = new SoapClient('http://www.textapp.net/webservice/service.asmx?wsdl', $proxy);

Footer Bottom