HTTP API for Bulk SMS sending
HTTP is the simplest way of connecting to ez4usms. You only have to perform a HTTP call using the programming language of your choice.
- Supports text, Unicode and flash messaging.
- Support for all languages with special characters (Arabic, Chinese, Greek etc)
- Support for concatenated messages (long SMS)
- Support for bulk sms sendings
- Dynamic sender identity
- Delivery reports
- Easy to use
How to connect via HTTP
Sign up to our system. Use your free credits in order to make your tests
For send SMS a get request is needed at the following URL:
http://ez4usms.com/api/http/send.php
The parameters for this request are:
username (required), username
password (required), password
from (required), sender’s identity for the message
to (required), recipients for the message comma seperated without spaces
message (optional), text of the message
coding (optional), coding that message will be sent. Possible choices: GSM, UTF-8. Default value: GSM.
flash (optional), send flash sms. Possible values: 0 or 1. Default value: 0.
All values for the above parameters have to be url encoded
Example of a request:
http://ez4usms.com/api/http/send.php?username=xxx&password=xxx&from=myself&message=text+at+utf8+format&to=306912345678,306998765432
Every succesfull request returns an ID
eg ID:0008FABD Message identifier
Τhis request may return the following error messages:
Error: Authentication error.
Error: No recipients.
Error: Invalid sender identity.
Error: Insufficient credits.
Error: Invalid scheduling date.
Schedule SMS via HTTP API
At the end of your HTTP call add the parameter schedule:
eg : &schedule=SCHEDULE_DATE_TIME
Examples for SCHEDULE_DATE_TIME:
2011-07-17
2011-05-11 14:40
2011-04-22 17:47:55
11 June 2011 11:00:00
+1 day
+1 week
+1 week 2 days 4 hours 2 seconds
next Thursday
last Monday
If there is an error in the parameter schedule system will return:
Error: Invalid scheduling date.
Define the URL you want to recieve delivery receipts
At the end of your HTTP call add the parameter dlr-url
eg : &dlr-url=ENCODED_URL
The parameter dlr-url should be url encoded
Check sent SMS status
For checking the status of an SMS a get request is needed at the following URL:
http://ez4usms.com/api/http/query.php
The parameters for this request are:
username (required), username
password (required), password
mid (required), message’s identifier
mobile (required), recipient’s mobile
All values for the above parameters have to be url encoded
Example of a request:
http://ez4usms.com/api/http/query.php?username=xxx&password=xxx&mid=0008FABD&mobile=306912345678
This request may return the following messages:
Status: Queued
Status: Pending
Status: Delivered
Status: Failed
Τhis request may return the following error messages:
Error: Authentication error.
Error: No message ID defined.
Error: No mobile defined.
Error: No such message or recipient.
<?php
$url = 'ez4usms.com';
// open a socket to ez4usms server
$socket = fsockopen($url, 80, $errorno, $error, 30);
if( $socket == false )
{
// something went wrong!
}
else
{
// initialize request variables
$username = urlencode('x');
$password = urlencode('x');
$from = urlencode('x');
$to = urlencode('306991231111,6941236546');
$message = urlencode('test message');
// construct the request path with all required parameters
$path = '/api/http/send.php?';
$path .= "username={$username}&";
$path .="password={$password}&";
$path .="from={$from}&";
$path .="to={$to}&";
$path .="message={$message}";
// create request headers
$req = "GET {$path} HTTP/1.1\r\n";
$req .= "Host: {$url}\r\n";
$req .= "Connection: Close\r\n\r\n";
$output = '';
// make request
if( fputs($socket, $req) === false )
{
// something went wrong with the request
return;
}
// read server response
while( !feof($socket) )
$output .= fgets($socket, 1024);
// manage response
$lines = explode("\n", $output);
$result = end($lines);
$parts = explode(":", $result);
if( $parts[0] == 'Error' )
{
// an error occured
// output the error message
echo $parts[1];
}
else if( $parts[0] == 'ID' )
{
// message was successfully sent to recipients
// output the ID of the message
echo $parts[1];
}
}
?>