Using the CURL library itself would look like this:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://api.urlapi.com.br');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"menssage\": \"Aqui envio a mensagem\", \"number\": \"55123456789\"}");
$headers = array();
$headers[] = 'Accept: application/json';
$headers[] = 'Authorization: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
However I recommend you use the Guzzle library, it is one of the most used to make requests, the documentation is well explained: http://docs.guzzlephp.org/en/stable/
Thank you, thank you!
– Bruno Oliveira