PHP code example of raphaelvserafim / client-php-api-wa-me
1. Go to this page and download the library: Download raphaelvserafim/client-php-api-wa-me library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
raphaelvserafim / client-php-api-wa-me example snippets
$to = '556696852025'; // if it's a group, use full id ex: [email protected]
$status = 'composing'; // unavailable | available | composing | recording | paused
echo $whatsapp->sendPresence($to, $status);
$to = '556696852025'; // if it's a group, use full id ex: [email protected]
$text = 'Hi';
echo $whatsapp->sendText($to, $text);
$to = '556696852025'; // if it's a group, use full id ex: [email protected]
$url = ''; // your MP3 or OGG audio URL
echo $whatsapp->sendAudio($to, $url);
$to = '556696852025'; // if it's a group, use full id ex: [email protected]
$url = '';
$caption = '';
echo $whatsapp->sendImage($to, $url);
$to = '556696852025'; // if it's a group, use full id ex: [email protected]
$url = '';
$caption = '';
echo $whatsapp->sendVideo($to, $url);
$to = '556696852025'; // if it's a group, use full id ex: [email protected]
$url = '';
$caption = '';
$mimetype = 'application/pdf'; // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
$fileName='';
echo $whatsapp->sendDocument($to, $url, $mimetype, $fileName);
$to = '556696852025'; // if it's a group, use full id ex: [email protected]
$name = 'CACHE SISTEMAS';
$number = '+556696883327';
echo $whatsapp->sendContact($to, $name, $number);
$to = '556696852025'; // if it's a group, use full id ex: [email protected]
$lat = 37.7749;
$lon = -122.4194;
$address = '123 Main St, San Francisco, CA';
echo $whatsapp->sendLocation($to, $lat, $lon, $address);
$to = '556696852025'; // if it's a group, use full id ex: [email protected]
$text = '😘';
$msgId = '';
echo $whatsapp->sendReaction($to, $text, $msgId);