Last active
May 22, 2024 13:17
-
-
Save diogenesjup/1ec065faa315fc06173d52158aea2755 to your computer and use it in GitHub Desktop.
Exemplo PHP CURL WATIS API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => 'SEU ENDPOINT', | |
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 => 'origem=postman&destino=5511999999999&msg=Mensagem&controle=TOKEN&imagem=', | |
CURLOPT_HTTPHEADER => array( | |
'Content-Type: application/x-www-form-urlencoded' | |
), | |
)); | |
$response = curl_exec($curl); | |
curl_close($curl); | |
echo $response; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment