Empowering Minds with Tech Knowledge.

How to send message using WhatsApp API?

How to send message using WhatsApp API?

03/February/2025 19:43    Comments (0)     Share:        Bookmark

You can use the below PHP code to send a message using our Whatsapp API.  

$url    = "https://wap-portal.xhost.co.in/api/v1/send.php";
$apikey = "Enter API Key";
$mobile = "Enter mobile number with 91 country code";
$msg    = "Enter message";
$media  = "Enter Image/PDF/Video URL";  //(Optional)

$data = [
    "api_key" => $apikey,
    "number"  => $mobile,
    "message" => $msg
];
if (!empty($media)) {
    $data["media_url"] = $media;
}

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => http_build_query($data),
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT        => 30,
    CURLOPT_CONNECTTIMEOUT => 10,
]);

$response = curl_exec($ch);
curl_close($ch);


Comments (0)
Leave a Reply

Your email address and mobile will not be published.

Trending Blog
How to install SSL in cPanel?
16/October/2024 12:24
How to install SSL in cPanel?
How to setup News/Blog website?
16/October/2024 22:55
How to setup News/Blog website?
How to setup a prime website?
09/January/2025 14:26
How to setup a prime website?
How to install software in aaPanel?
16/October/2024 18:13
How to install software in aaPanel?
How to setup basic website?
16/October/2024 19:04
How to setup basic website?
How to install SSL in Vestacp Panel?
24/September/2024 17:12
How to install SSL in Vestacp Panel?
Related Blog

17/October/2024 16:16 Comments (0)
How to replace Fast2SMS?
03/December/2025 10:53 Comments (0)
How to link your number with WhatsApp API?

Subscribe our Newsletter