SMSgw.net API Documentation

This describes the all Services that allow you deal with our API .

Parameters Definition

Parameter Definition
strUserName The username or Mobile number (format: 9665xxxxxxx).
strPassword The account password.
strTagName The sender name in alphanumeric format.
strRecepientNumbers One or more mobile number separated by a semicolon(;)[used in SendBulkSMS service (format: Use 05xxxxxxxx, 5xxxxxxxx, 9665xxxxxxxx, 009665xxxxxxxx for any national mobile number and use the format 00 then country code or + then country code for any international mobile number).
strMessage Message content (70 Character for the 1 st single message and 67 for more than single message for ARABIC Message, and 160 Character for the 1 st single message and 158 for more than single message for ENGLISH Message.).
sendDateTime Server Date time of sending the message, used for scheduled messages (which must be at least 5 minutes a head), to send directly provide without schedule (0) zero value. To send on scheduled date use format (yyyyMMddHHmm) (ex: 201412081638) as long value
VarsList List of variables to be replaced in custom message service, which separated by semicolon (;) e.g.: [Name];[Salary]. The variables list could be anything except the semicolon itself.
ReplacementList List of replacements, which separated by semicolon (;) e.g.: Name1,5000;Name2,4000.
strCode The number you will get after calling as Service:
  • 0:Failed
  • 1:Success
  • 2:Pending
  • -10:Invalid UserName and Password
  • -20:Invalid TagName Format
  • -30:TagName doesn't exist
  • -40:Insufficient Fund
  • -40:strRecepientNumber Length does not equal to ReplacementList Length
  • -50:strRecepientNumber Length does not equal to ReplacementList Length
  • -60:Invalid Mobile Number
  • -70:System Error
strCode Int
strSubUserName The username or Mobile number for sub account.
strSubPassword The password for sub account.
strPoints The sub account messages count.

GetstrCodeDescription

Service allows you to know error code values that are produced by our system

POST http://api.smsgw.net/GetstrCodeDescription

Parameter Type Required Example
strCode Int Yes -1

GetCredit

Service allows you to inquire about available messages balance remaining in your account.

POST http://api.smsgw.net/GetCredit

Parameter Type Required Example
strUserName String Yes 9665xxxxxxx
strPassword String Yes

Response

number of credit

Example:


<?php
//parameters 
$post = array(
            
'strUserName' => 'test'
            
'strPassword' => 'test',
        );
//post parameters to URL 
echo PostData('http://api.smsgw.net/GetCredit'$post);

//post function
function PostData($url$post) {
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
    
curl_setopt($chCURLOPT_HEADERFALSE);
    
curl_setopt($chCURLOPT_POSTTRUE);
    
curl_setopt($chCURLOPT_POSTFIELDS$post);
    
$data curl_exec($ch);
    return(
$data);
}
?>

IsServiceAlive

Service allows you to check if the service is working or not. [You may use this before sending messages to check the service status]

POST http://api.smsgw.net/IsServiceAlive

Parameter Type Required Example
none none none none

Example:


<?php

echo file_get_contents('http://api.smsgw.net/IsServiceAlive');

?>

SendBulkSMS

Service allows you to send message to multiple mobile numbers in one call.

POST http://api.smsgw.net/SendBulkSMS

Parameter Type Required Example
strUserName String Yes 9665xxxxxxx
strPassword String Yes
strTagName String Yes SMSgw.net
strRecepientNumbers String Yes 05xxxxxxxx,5xxxxxxxx,9665xxxxxxxx,009665xxxxxxxx
strMessage String Yes Test Message
sendDateTime Date No yyyyMMddHHmm (201412081638)

Example:


<?php
//parameters 
$post = array(
            
'strUserName' => 'test'
            
'strPassword' => 'test',
            
'strTagName'  => 'SMSgw.net',
            
'strRecepientNumbers'  => '05xxxxxxxx;5xxxxxxxx;9665xxxxxxxx;009665xxxxxxxx',
            
'strMessage'  => 'Test Message',
        );
//post parameters to URL 
echo PostData('http://api.smsgw.net/SendBulkSMS'$post);

//post function
function PostData($url$post) {
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
    
curl_setopt($chCURLOPT_HEADERFALSE);
    
curl_setopt($chCURLOPT_POSTTRUE);
    
curl_setopt($chCURLOPT_POSTFIELDS$post);
    
$data curl_exec($ch);
    return(
$data);
}
?>

SendCustomBulkSMS

Service allows you to send message to multiple mobile numbers in one call and replace VarsList with ReplacementList in each SMS.

POST http://api.smsgw.net/SendCustomBulkSMS

Parameter Type Required Example
strUserName String Yes 9665xxxxxxx
strPassword String Yes
strTagName String Yes SMSgw.net
strRecepientNumbers String Yes 05xxxxxxxx,5xxxxxxxx,9665xxxxxxxx,009665xxxxxxxx
strMessage String Yes Mr [Name] your salary is [Salary]
VarsList String Yes [Name];[Salary]
ReplacementList String Yes Name1,5000;Name2,4000;Name3,3000;Name4,2000

Example:


<?php
//parameters 
$post = array(
            
'strUserName' => 'test'
            
'strPassword' => 'test',
            
'strTagName'  => 'SMSgw.net',
            
'strRecepientNumbers'  => '05xxxxxxxx;5xxxxxxxx;9665xxxxxxxx;009665xxxxxxxx',
            
'strMessage'  => 'Mr [Name] your salary is [Salary]',
            
'VarsList'  => '[Name];[Salary]',
            
'ReplacementList'  => 'Name1,5000;Name2,4000;Name3,3000;Name4,2000',
        );
//post parameters to URL 
echo PostData('http://api.smsgw.net/SendCustomBulkSMS'$post);

//post function
function PostData($url$post) {
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
    
curl_setopt($chCURLOPT_HEADERFALSE);
    
curl_setopt($chCURLOPT_POSTTRUE);
    
curl_setopt($chCURLOPT_POSTFIELDS$post);
    
$data curl_exec($ch);
    return(
$data);
}
?>

SendInternationalSMS

Service allows you to send single message to one international mobile number.

POST http://api.smsgw.net/SendInternationalSMS

Parameter Type Required Example
strUserName String Yes 9665xxxxxxx
strPassword String Yes
strTagName String Yes SMSgw.net
strRecepientNumber String Yes 009665xxxxxxxx
strMessage String Yes Test Message
sendDateTime Date No yyyyMMddHHmm (201412081638)

Example:


<?php
//parameters 
$post = array(
            
'strUserName' => 'test'
            
'strPassword' => 'test',
            
'strTagName'  => 'SMSgw.net',
            
'strRecepientNumber'  => '009665xxxxxxxx',
            
'strMessage'  => 'Test Message',
        );
//post parameters to URL 
echo PostData('http://api.smsgw.net/SendInternationalSMS'$post);

//post function
function PostData($url$post) {
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
    
curl_setopt($chCURLOPT_HEADERFALSE);
    
curl_setopt($chCURLOPT_POSTTRUE);
    
curl_setopt($chCURLOPT_POSTFIELDS$post);
    
$data curl_exec($ch);
    return(
$data);
}
?>

SendSingleSMS

Service allows you to send single message to one mobile number in one call.

POST http://api.smsgw.net/SendSingleSMS

Parameter Type Required Example
strUserName String Yes 9665xxxxxxx
strPassword String Yes
strTagName String Yes SMSgw.net
strRecepientNumber String Yes 05xxxxxxxx
strMessage String Yes Test Message
sendDateTime Date No yyyyMMddHHmm (201412081638)

Example:


<?php
//parameters 
$post = array(
            
'strUserName' => 'test'
            
'strPassword' => 'test',
            
'strTagName'  => 'SMSgw.net',
            
'strRecepientNumber'  => '05xxxxxxxx',
            
'strMessage'  => 'Test Message',
        );
//post parameters to URL 
echo PostData('http://api.smsgw.net/SendSingleSMS'$post);

//post function
function PostData($url$post) {
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
    
curl_setopt($chCURLOPT_HEADERFALSE);
    
curl_setopt($chCURLOPT_POSTTRUE);
    
curl_setopt($chCURLOPT_POSTFIELDS$post);
    
$data curl_exec($ch);
    return(
$data);
}
?>

AddSubAccount

Service allows you to create new sub account with initial balance.

POST http://api.smsgw.net/AddSubAccount

Parameter Type Required Example
strUserName String Yes 9665xxxxxxx
strPassword String Yes
strSubUserName String Yes 05xxxxxxxx
strSubPassword String Yes
strPoints int Yes 100

Example:


<?php
//parameters 
$post = array(
            
'strUserName' => 'test'
            
'strPassword' => 'test',
            
'strSubUserName'  => '05xxxxxxxx',
            
'strSubPassword'  => '',
            
'strPoints'  => '100',
        );
//post parameters to URL 
echo PostData('http://api.smsgw.net/AddSubAccount'$post);

//post function
function PostData($url$post) {
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
    
curl_setopt($chCURLOPT_HEADERFALSE);
    
curl_setopt($chCURLOPT_POSTTRUE);
    
curl_setopt($chCURLOPT_POSTFIELDS$post);
    
$data curl_exec($ch);
    return(
$data);
}
?>

ListSubAccount

Service allows you to display sub account information .

POST http://api.smsgw.net/ListSubAccount

Parameter Type Required Example
strUserName String Yes 9665xxxxxxx
strPassword String Yes
strSubUserName String Yes 05xxxxxxxx

Example:


<?php
//parameters 
$post = array(
            
'strUserName' => 'test'
            
'strPassword' => 'test',
            
'strSubUserName'  => '05xxxxxxxx',
        );
//post parameters to URL 
echo PostData('http://api.smsgw.net/ListSubAccount'$post);

//post function
function PostData($url$post) {
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
    
curl_setopt($chCURLOPT_HEADERFALSE);
    
curl_setopt($chCURLOPT_POSTTRUE);
    
curl_setopt($chCURLOPT_POSTFIELDS$post);
    
$data curl_exec($ch);
    return(
$data);
}
?>

DelSubAccount

Service allows you to delete sub account.

POST http://api.smsgw.net/DelSubAccount

Parameter Type Required Example
strUserName String Yes 9665xxxxxxx
strPassword String Yes
strSubUserName String Yes 05xxxxxxxx

Example:


<?php
//parameters 
$post = array(
            
'strUserName' => 'test'
            
'strPassword' => 'test',
            
'strSubUserName'  => '05xxxxxxxx',
        );
//post parameters to URL 
echo PostData('http://api.smsgw.net/DelSubAccount'$post);

//post function
function PostData($url$post) {
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
    
curl_setopt($chCURLOPT_HEADERFALSE);
    
curl_setopt($chCURLOPT_POSTTRUE);
    
curl_setopt($chCURLOPT_POSTFIELDS$post);
    
$data curl_exec($ch);
    return(
$data);
}
?>