Docs

0 0 0 0

REST API Interface

REST API Documentation

The simplicity of implementation makes REST API Interface most often used method of integration with SMSAPI service. Using REST API you are able to integrate any software or web application with SMSAPI service.

File name: Version: Last update: Download
REST API Documentation - basic functions 1.0 08.07.2015
REST API Documentation - external functions 1.0 08.07.2015

Example scripts in PHP


Examples of sendeing SMS messages in PHP


1 Sending SMS message using backup server

<?php
function sms_send($params$backup false ) {
    
    static 
$content;
    
    if(
$backup == true){
        
$url 'https://api2.smsapi.com/sms.do';
    }else{
        
$url 'https://api.smsapi.com/sms.do';
    }
    
    
$c curl_init();
    
curl_setopt$cCURLOPT_URL$url );
    
curl_setopt$cCURLOPT_POSTtrue );
    
curl_setopt$cCURLOPT_POSTFIELDS$params );
    
curl_setopt$cCURLOPT_RETURNTRANSFERtrue );
    
    
$content curl_exec$c );
    
$http_status curl_getinfo($cCURLINFO_HTTP_CODE);
    
    if(
$http_status != 200 && $backup == false){
        
$backup true;
        
sms_send($params$backup);
    }
            
    
curl_close$c );    
    return 
$content;
}

$params = array(
     
'username' => 'username',
     
'password' => 'password-md5',
     
'to' => '500000000',
     
'from' => 'SMSAPI',
     
'message' => "My SMS message",
);

echo 
sms_send($params);
?>

2 Sending SMS using POST method.

 <?php
$username 
'username';                    //SMSAPI.com username
$password 'password-md5');               //lub $password = md5('open-text-password'),
$to '48500000000';                      //recipient number
$from 'SMSAPI';                       //sender name MUST be active
$message "My SMS message";             //message content
$url 'https://api.smsapi.com/sms.do';
$c curl_init();
    
curl_setopt($cCURLOPT_URL$url);
    
curl_setopt($cCURLOPT_POSTtrue);
    
curl_setopt($cCURLOPT_POSTFIELDS'username='.$username.'&password='.$password.'&from='.$from.'&to='.$to.'&message='.$message);
    
curl_setopt($cCURLOPT_RETURNTRANSFERtrue); 
    
$content curl_exec ($c);
    
curl_close ($c); 
echo 
$content;
?>