Login to your account: Login 

Simple Connectivity with Wrappers (PHP)

Wonderfully easy, our API wrappers offer you simplicity with the greatest flexibility. As with all our developer solutions, we offer expert support if you have any integration questions.

PHP wrapper    

 

A few Simple Uses

Send

<?php
//Send an SMS

include_once('TMRestClient.php');
$tmClient = new TMRestClient('MyUser', 'MyPass', 'production');
$tmClient->sendSMS('Hello SMS World!', '447000000000', 'SenderName');
?>

Check Balance

<?php
//Get credits available

include_once('TMRestClient.php');
$tmClient = new TMRestClient('MyUser', 'MyPass', 'production');
$creditsAvailable = $tmClient->getCredits();
?>

Delivery Reports

<?php
//Get a delivery report of all messages sent

include_once('TMRestClient.php');
$tmClient = new TMRestClient('MyUser', 'MyPass', 'production');
$result = $tmClient->getDeliveryReport('all');
foreach ($result as $key => $report) {
	foreach ($report['reportrow'] as $key => $reportrow) {
		echo "Msg ID: {$reportrow['message_id']}, to: {$reportrow['mobile_number']}, is: {$reportrow['status']}<br/>\n";
	}
}
?>

 

Some Text Marketer Account functions

Create Accounts

<?php
//Create a sub-account

include_once('TMRestClient.php');
$tmClient = new TMRestClient('MyUser', 'MyPass', 'production');
$tmClient->createSubAccount('My client', '447000000000');
?>

Credit Transfers

<?php
//Transfer 5000 credits to another account

include_once('TMRestClient.php');
$tmClient = new TMRestClient('MyUser', 'MyPass', 'production');
$tmClient->transferCreditsToUser(5000, 'targetAPIusername', 'targetAPIpassword');
?>

 

Refine and error capture

To complete your code you should add some error handing, to catch exceptions. All you need to do is put the wrapper function calls in a try-catch block as follows.

<?php
include_once('TMRestClient.php');
$tmClient = new TMRestClient('MyUser', 'MyPass', 'production');
try {
	$success = false;
	$tmClient->sendSMS('Hello SMS World!', '447000000000', 'SenderName');
	// if the send fails, execution jumps to the start of the catch-block
	$success = true; 
	$creditsAvailable = $tmClient->getCredits();
} catch (Exception $exception) {
	$errors = $tmClient->getLastErrors();
	foreach($errors as $errorcode => $errormsg)
		echo "Code $errorcode: $errormsg";
}
if (!$success)
	echo "There was a problem sending the message";
else
	echo "There are $creditsAvailable credits left";
?>

It is up to you to decide how to handle the errors. We also recommend that you log them for debugging purposes. A list of the possible error codes is available in the full documentation below.

Our example code is an illustration of how you might integrate with our systems and is not certified for production environments. You are responsible for testing and QA.

 

More Information

For a fuller explanation, including all the operations available and how to handle errors please download the PDF documents

Full Wrapper Documentation

What some of our clients say...

Text Marketer Clients

“This is so easy to use, we got up and running in 5 minutes.”

Sales increased by 32% using this sms service”

“Low priced and incredibly efficient

Our example code is an illustration of how you might integrate with our systems and is not certified for production environments. You are responsible for testing and QA.

The RESTful API is our flagship API which gives you greater control and enhanced facilities. It may be that your requirements do not warrant the enahnced facilities the RESTful API provides. If this is the case, you may wish to consider our simple SMS Gateway API.

Pricing

Follow Us

For all the latest news, follow us:

Bulk SMS RSS FeedFollow TextMarketer on TwitterFollow TextMarketer on FacebookFollow TextMarketer on SlideshareFind Text Marketer on Google Plus

 
Contacts

Tel: +44 (0) 117 205 0202

txtUs: 07860 021 840

Fax: 0870 458 0383

 

Email

This email address is being protected from spambots. You need JavaScript enabled to view it.