php push whatsapp notification 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 = ""; // PHPHive WhatsAPI Token, Get it from http://wapi.phphive.info
$wa_uid = ""; // WhatsApp Username
$wa_pwd = ""; // WhatsApp Password
$wa_recp = ""; // Recipient
$wa_msg  = ""; // Message You want to Send
 
$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;
 
?>

Tags:

Php Example