API Documentation

How to send SMS via API?

username - Username
password - Password
sender - SMS Sender
def_time - Time to send bulk SMS, if not defined, current time will be used
id - optional unique ID of SMS generated by the customer, identification for delivery receipts HTTP GET/POST method
name - optional Customer Name
idc - optional Customer ID, for exporting delivery receipts to CSV, XLS
send_time - SMS sending time, superior def_time
unicode - SMS will be sent with diacritics
phone - Phone Number
text - SMS Text
callback - a delivery receipt for SMS will be sent to the defined URL. It is necessary to define a unique message ID for subsequent assignment of SMS delivery status

Príklad odoslania SMS

define('XML_PAYLOAD', '<?xml version="1.0" encoding="UTF-8"?>
        <password>password or API key</password>
        <def_time>2016-12-31 23:59:00</def_time>
            <text>Text first SMS</text>
             <send_time>2017-12-31 23:59:00</send_time>
            <text>Text SMS 2 unicode čžýáíáť</text>
             <name>Janko Hraško</name>
             <text>Text 3</text>
define('XML_POST_URL', 'https://www.affilsms.com/api/sms-xml/'); 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, XML_POST_URL); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_TIMEOUT, 60); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close')); 
$result = curl_exec($ch); 
if (curl_errno($ch) ) 
$result = 'ERROR -> ' . curl_errno($ch) . ':' . curl_error($ch); 
$returnCode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE); 
   case 200: $xmlObject = new SimpleXMLElement($result);   
             $status = $xmlObject->status; 
             $balance = $xmlObject->balance; 
             $errorsms = $xmlObject->errorsms;
             $failedsms = $xmlObject->failedsms;  
   case 404: 
   $result = 'ERROR -> 404'; 



XML Response




1 incoming call

- 1 incorrect login credentials

sentsms number of successfully received SMS into the system

errorsms number of unsent SMS due to incorrect numbers

failedsms number of unsent SMS due to low credit



Delivery Receipts -

status: status=delivered, undelivered

id: id=123456