Я хочу отправить sms с Restful API Bulksmsonline.com, но не понимаю, что не так с моим кодом. Учетные данные настоящие, если вы хотите пройти тест.
https://bulksmsonline.com/developers/
Раздел Restful API
Вот мой код:
$tok=file_get_contents('https://restapi.bulksmsonline.com/rest/api/v1/sms/gettoken/username/ngosda367/password/Tempcred01');
$toke =json_decode($tok, true);
$token=$toke['token'];
$data = json_encode(
array(
'from' => 'TEST',
'to' => '332698741113',
'type'=> 'Text',
'content'=> 'Test',
'sendDateTime'=> '2020/07/07'
))
;
$options = array('http' =>
array(
'method' => 'POST',
'header' => "Content-type: application/json; charset=utf-8\r\n" .
"Content-length: " . strlen($data) . "\r\n" .
"Authorization Token: " . base64_encode("$token") . "\r\n",
'content' => $data
)
);
$context = stream_context_create($options);
$url = 'https://restapi.bulksmsonline.com/rest/api/v1/sms/send';
$result = file_get_contents($url,false,$context);
var_dump($result);
Вот ответ, который я получаю:
failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Reques. bool(false)
СПАСИБО за вашу помощь