Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function sendWhatsappMessage(string $target, string $message): bool
- {
- $token = 'TOKEN';
- $curl = curl_init();
- curl_setopt_array($curl, array(
- CURLOPT_URL => 'https://api.fonnte.com/send',
- 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 => array(
- 'target' => $target,
- 'message' => $message,
- ),
- CURLOPT_HTTPHEADER => array(
- 'Authorization: ' . $token
- ),
- ));
- $response = curl_exec($curl);
- curl_close($curl);
- $data = json_decode($response, false);
- return $data->status;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement