Enviando Mensagens de Texto Com API de SMS Gratis com PHP e Guzzle

API DE SMS COM GUZZLE USANDO PHP

Veja um exemplo prático!

Salve esse arquivo como sms.php

<?php

$client = new Client();
$headers = [
  'Content-Type' => 'application/json',
  'DeviceToken' => 'd1eae908-907b-4350...',
  'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....'
];

$url = "https://gateway.apibrasil.io/api/v2/sms/send";

$body = '{
    "number": "5531994359434",
    "message": "Ola mundo!"
}';

$request = new Request('POST', $url, $headers, $body);
$res = $client->sendAsync($request)->wait();

var_dump($res->getBody());

Obtenha suas credenciais
https://apibrasil.com.br