venomous0x / WhatsAPI

Interface to WhatsApp Messenger
2.59k stars 2.14k forks source link

Not able to recevie message using onGetMessage Function #1200

Open tapan-mittal opened 8 years ago

tapan-mittal commented 8 years ago

Hi , I am not able to receive message bu using onGetMessage function in PHP.I have used below mentioned code ..

<?php

require 'MyEvents.php'; require_once '../whatsprot.class.php';

$userPhone = '91XXXXXXXX06'; $identity = strtolower(urlencode(sha1($userPhone, true))); $nickname = "AA"; $userName = '91XXXXXXXX06'; $password = 'XXXXXXXXXXXXXX/jP33qcEkY='; $debug = true; $token = $userPhone;

echo ':::::::::::::::OutSide OnMessage Function:::::::::::::'; function GetMessage($mynumber, $from, $id, $type, $time, $name, $body) { echo '................InSide OnMessage Function.........'; $a = "Message from $name:\n$body\n$time\n$mynumber\n$from\n$type"; echo $a . '..................\n'; }

$w = new WhatsProt($userName, $identity, $nickname, $debug); $w->eventManager()->bind("onGetMessage", "GetMessage"); $w->Connect(); $w->loginWithPassword($password);

for ($i = 0; $i < 5; $i++) { $w->pollMessage(); } $w->disconnect();

I have already uncomment the onGetMessage function in events.php. Few days back it was working fine suddenly it stopped working because of old version issue. Now i have updated to new version but not able to receive any message. Kindly let me know where i am doing the mistake.

Thanks & Regards, Tapan Mittal