php send whatsapp message code example
Example 1: how to make a message for whatsapp in php
{
"request": true,
"response": [
{
"mynumber": "WhatsApp Username",
"fromNo": "XXXXXXXXXX",
"fromName": "Puneet Mehta",
"msgId": "D799FF10BED49CD9F9",
"msgType": "text",
"msgTime": "1469001844",
"msg": "Hey"
},
{
"mynumber": "WhatsApp Username",
"fromNo": "XXXXXXXXX",
"fromName": "Puneet Mehta",
"msgId": "3510107294D97960F0",
"msgType": "text",
"msgTime": "1469001844",
"msg": "Hi"
}
]
}
Example 2: how to make a message for whatsapp in php
<?PHP
$token = "";
$wa_uid = "";
$wa_pwd = "";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://wapi.phphive.info/api/message/receive.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,"token=".$token."&wa_uid=".$wa_uid."&wa_pwd=".$wa_pwd);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);
echo $server_output;
?>
Example 3: how to make a message for whatsapp in php
<?PHP
$token = "";
$wa_uid = "";
$wa_pwd = "";
$wa_recp = "";
$wa_msg = "";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://wapi.phphive.info/api/message/send.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,"token=".$token."&wa_uid=".$wa_uid."&wa_pwd=".$wa_pwd."&wa_recp=".$wa_recp."&wa_msg=".urlencode($wa_msg));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);
echo $server_output;
?>