Skip to content

Instantly share code, notes, and snippets.

@jhowbhz
Last active January 5, 2024 22:22
Show Gist options
  • Save jhowbhz/e393577603c05b54029009d2046ca182 to your computer and use it in GitHub Desktop.
Save jhowbhz/e393577603c05b54029009d2046ca182 to your computer and use it in GitHub Desktop.
Exemplo sendText PHP com Myzap
<?php
/****************************************************************************************************************/
/* Antes de utilizar esses codigos, inicie a sessão em https://whatsapp-v2.apibrasil.com.br/start */
/****************************************************************************************************************/
try {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://apiwhatsapp-7150.apibrasil.com.br//sendText',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"session" : "teste",
"number" : "5531994359434",
"time_typing": 1,
"text": "teste"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'sessionkey: teste'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
curl_close($curl);
var_dump($callback); // callback
} catch (\Throwable $th) {
throw $th;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment