Send SMS Sample Code
Sample code using Send SMS API.
Sample PHP Code
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '
https://api.smarthivesms.com/api/sms/send',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"sender" : "SmartHive",
"recipients" : "09012345678",
"msg" : "THis is my message",
"type": 1,
"route": "OPEN"
}',
CURLOPT_HTTPHEADER => array(
'x-api-key: 88e9be59-6f47-4d81-89b4-############',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Sample Go code
Last updated