Пример интеграции Flash Call



  1. <?php
  2.  
  3. $ch = curl_init();
  4.  
  5. $recipient = '79000000000'; // client's phone number
  6. $sender_id = 'sms-boom'; // do not change
  7. $message = '1234'; // your XXXX client's code. You can generate random from your side
  8.  
  9.  
  10.  
  11. curl_setopt($ch, CURLOPT_URL, 'https://my.sms-boom.ru/api/v3/sms/send');
  12.  
  13. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
  14.  
  15. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  16.  
  17. curl_setopt($ch, CURLOPT_HTTPHEADER, [
  18. 'Authorization: Bearer XXXXXXXXXXXXXXXXX',
  19. 'Content-Type: application/json'
  20. ]);
  21.  
  22.  
  23. // json body
  24. $json_array = [
  25. 'recipient' => $recipient,
  26. 'sender_id' => $sender_id,
  27. 'message' => $message,
  28. 'Authorization' => 'Bearer XXXXXXXXXXXXXXXXX' // your Bearer token. Copy it from your cabinet - https://my.sms-boom.ru/developers, "API Token"
  29. ];
  30. $body = json_encode($json_array);
  31.  
  32. // set body
  33. curl_setopt($ch, CURLOPT_POST, 1);
  34. curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
  35.  
  36. // send the request and save response to $response
  37. $response = curl_exec($ch);
  38.  
  39. // stop if fails
  40. if (!$response) {
  41. die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
  42. }
  43. echo 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;
  44. echo 'Response Body: ' . $response . PHP_EOL;
  45. curl_close($ch);
  46.  
  47. ?>

Зарегистрироваться
и попробовать БЕСПЛАТНО