This interface allows you to remotely determine your Textlocal account balance. To connect to this interface, simply GET or POST your query to the URL below. For added security, connect to our API via SSL by replacing 'http' with 'https'.
We have a number of code examples available, however if you see a language that we don't have, please contact us, as it's more than likely we'll be able to create one for you.
<?php // Authorisation details $uname = "youremailaddress"; $pword = "yourpassword"; // Prepare data for POST request $data = "uname=".$uname."&pword=".$pword; // Send the POST request with cURL $ch = curl_init('http://www.txtlocal.com/getcredits.php'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $credits = curl_exec($ch); //This is the number of credits you have left curl_close($ch); ?>
The following is a list of variables that can be defined: (* indicates optional)
|uname||Your Textlocal username.|
|pword||Your Textlocal password.|
|mms *||Set to true if you require MMS Credit balance, otherwise do not set.|
The information passed back will be one of the following:
Invalid - meaning incorrect login details
A number, which relates to the number of credits available