Summary
The SMS Broadcast API allows programmers to integrate message sending capabilities into their website or application.
The API as based on HTTP (Post or Get) requests that are sent to our server. The request includes your account username and password for authentication, as well as the details of each message to be sent. The API will reply to each request with a confirmation, or details of a failure.
Sending a message via the API
The URL for the API is:
http://api.smsbroadcast.com.au/api.php
Fields:
username - Your SMS Broadcast account username. This will be the same username that is used to login to the SMS Broadcast website.
password - Your SMS Broadcast account password. This will be the same password that is used to login to the SMS Broadcast website.
from - The message sender. This will appear as the sender of the message on the recipient's mobile phone. This field should be in the format of 61400111222 0400111222 or MyCompany. This field is limited to 11 characters. This field should only contain letter or numbers, without any punctuation.
to - The recipient of the SMS message. This field should be in the format of 61400111222 or 0400111222. The numbers should not include any spaces or other punctuation. Multiple numbers can be entered, separated by a comma.
message - The content of the SMS message. This field should be URL Encoded and is limited to 160 characters once the message is URL decoded by the API. Any additional characters will be automatically dropped by the API.
Below is an example of how an API request may appear:
http://api.smsbroadcast.com.au/api.php?username=myuser&password=abc123&from=0400111222&to=0411222333,0422333444&message=Hello%20world
The message data may also be sent using a form post if your application supports it.
Checking the API result
The API will return a string with the result of your request. The result will detail any error that may occur. Below is a list of every possible API result.
Success:
Your message was sent.
Failure:
ERROR: No username was entered. Please refer to the help pages for more information
ERROR: No password was entered. Please refer to the help pages for more information
ERROR: Sorry, the username or password is incorrect.
ERROR: No receiving number was entered. Please refer to the help pages for more information
ERROR: No from number was entered. Please refer to the help pages for more information
ERROR: No message was entered. Please refer to the help pages for more information
ERROR: Sorry, you do not have enough credits remaining.
Example PHP Code
Sending an SMS Message:
<?
$user = "myuser";
$pass = "abc123";
$to = "0400111222,0411222333";
$from = "MyCompany";
$message = urlencode("Hello World!");
$url = "http://api.smsbroadcast.com.au/api.php?".
"username=$user&password=$pass&from=$from&to=$to&message=$message";
$result = file_get_contents($url);
echo $result;
?>
Checking the API Result:
<?
if($result == "Your message was sent."){
echo "Success";
} else {
echo "The message failed. The reason is: $result";
}
?>