Advertisement
techblog

callmebot-whatsapp-php-curl

Mar 15th, 2022
1,366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. function send_whatsapp($message="Test"){
  2.     $phone="+49123123123";  // Enter your phone number here
  3.     $apikey="123456";       // Enter your personal apikey received in step 3 above
  4.  
  5.     $url='https://api.callmebot.com/whatsapp.php?source=php&phone='.$phone.'&text='.urlencode($message).'&apikey='.$apikey;
  6.  
  7.     if($ch = curl_init($url))
  8.     {
  9.         curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
  10.         curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
  11.         $html = curl_exec($ch);
  12.         $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  13.         // echo "Output:".$html;  // you can print the output for troubleshooting
  14.         curl_close($ch);
  15.         return (int) $status;
  16.     }
  17.     else
  18.     {
  19.         return false;
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement