Skip to content

Instantly share code, notes, and snippets.

@ajangrahmat
Created December 3, 2023 05:33
Show Gist options
  • Save ajangrahmat/9dbfbe59ff5f02a0af329ffcc534b406 to your computer and use it in GitHub Desktop.
Save ajangrahmat/9dbfbe59ff5f02a0af329ffcc534b406 to your computer and use it in GitHub Desktop.
<?php
$phone = '6281000000000';
$text = 'Tes kirim pesan';
$apiKey = '0000000';
$url = 'https://api.callmebot.com/whatsapp.php';
$data = array(
'phone' => $phone,
'text' => $text,
'apikey' => $apiKey
);
$options = array(
CURLOPT_URL => $url . '?' . http_build_query($data),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_SSL_VERIFYPEER => false, // Hati-hati penggunaan ini di lingkungan produksi
);
$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if ($err) {
echo "Error: $err";
} else {
echo "Response: $response";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment