11
REST Web service API - Send multiple sms in bulk (send)
Curl
curl --location --request POST
"https://sms.deals/api/ws_json_bulk.php" \
--header "Content-Type: application/json" \
--header “Authorization: Bearer xxxxxx…“ \
--data "[
{
\"service\": \"send_sms\",
\"dest\": \"0521231231\",
\"sender\": \"0521231221\",
\"message\": \"Hello world User example 1\"
},
{
\"service\": \"send_sms\",
\"dest\": \"0541231221\",
\"sender\": \"0541231231\",
\"message\": \"Hello world User example 2\"
}
]"
Php
$curl = curl_init();
$json = array(
array(
'service' => 'send_sms, 'dest' => '0521231231',
'sender' => '0541231231', 'message' => 'Hello world User example 1'
),
array(
'service' => 'send_sms', 'dest' => '0521231232',
'sender' => '0541231232', 'message' => 'Hello world User example 2'
)
);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sms.deals/api/ws_json_bulk.php",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($json),
CURLOPT_HTTPHEADER=> array(
"Authorization: Bearer " . $token
)
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}Notes: This service requires registration of requesting server IP on the account settings page.