BulkSMS Integration

Single textual message to one destination

<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "http://smsapi.yatosha.com/sms/2/text/single",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{ \"from\":\"InfoSMS\", \"to\":\"41793026727\", \"text\":\"Test SMS.\" }",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    "content-type: application/json"
  ),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

 

JSON

POST /sms/2/text/single HTTP/1.1
Host: smsapi.yatosha.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json
{  
   "from":"InfoSMS",
   "to":"41793026727",
   "text":"Test SMS."
}

 

XML

POST /sms/2/text/single HTTP/1.1
Host: {base_url}
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/xml
Accept: application/xml
<request>
   <from>InfoSMS</from>
   <to>
      <to>41793026727</to>
   </to>
   <text>Test SMS.</text>
</request>

 

Response:

JSON

HTTP/1.1 200 OK
Content-Type: application/json
{  
   "messages":[  
      {  
         "to":"41793026727",
         "status":{  
            "groupId":1,
            "groupName":"PENDING",
            "id":26,
            "name":"MESSAGE_ACCEPTED",
            "description":"Message sent to next instance"
         },
         "messageId":"2250be2d4219-3af1-78856-aabe-1362af1edfd2"
      }
   ]
}

 

XML

HTTP/1.1 200 OK
Content-Type: application/xml
<smsResponse>
   <messages>
      <message>
         <to>41793026727</to>
         <status>
            <id>26</id>
            <groupId>1</groupId>
            <groupName>PENDING</groupName>
            <name>PENDING_ACCEPTED</name>
            <description>Message sent to next instance</description>
         </status>
         <messageId>2250be2d4219-3af1-78856-aabe-1362af1edfd2</messageId>
      </message>
   </messages>
</smsResponse>

Please rate this article to help us improve our Knowledge Base.

1 0