Open Fidelity88 opened 10 years ago
Post some code. ¿You use "$w->eventManager()->bind(???,???) into a while?
No the eventmanager is called oustide of the while loop.
[...]
$w = new WhatsProt($username, 0, "xxxxxx", false);
$w->eventManager()->bind("onGetMessage", "onMessage");
$w->eventManager()->bind("onGetImage", "onImage");
$w->connect();
$w->loginWithPassword($password);
$time=1;
while($time <= 40)
{
if ($time <= 5) {
$w->pollMessages();
} else {
[...]
Since sending and receiving can't be done simultaneously, I always look for new messages the first 5 seconds. Then I process outgoing messages if there are any. When that is done I look for new messages again until the time run == 40 seconds :)
This is mi script very reduced to only receipt msgs y have test:
<?php
define('PATH', '/home/admon/WB');
require PATH.'/src/WhatsAPI/src/php/whatsprot.class.php';
require PATH.'/config.php';
$w = new WhatsProt(SEND, IMEI, NICK, DEBUG);
$w->Connect();
$w->LoginWithPassword(PASS);
$w->eventManager()->bind("onGetMessage", "GetMessage");
function GetMessage($mynumber, $from, $id, $type, $time, $name, $body){
echo $mynumber.'|'.$from.'|'.$id.'|'.$type.'|'.$time.'|'.$name.'|'.$body."\n";
//process de msg
}
while(TRUE){
$w->PollMessages();
sleep(1);
}
?>
So nobody actually knows what this error is causing is my conclusion now... I'm getting this error even when not receiving or sending out messages, so it would have nothing to do with the content or the time between messages.
I don't understand, but my script are online 3 months and always works perfectly. Receive messages, video and images from 7 groups with 6-30 participants simultaneously. Sorry for my English
It does work! But I keep getting errors. I can just ignore the errors, but rather fix it :)
Are you running multiple WhatsProt objects in the same script? WhatsProt class has some static properties used for encryption which don't allow multiple instances of WhatsProt at the same time.
Nope, only 1. So kinda weird I still get errors
Same issue here. I'm using ProcessNode class and method "setNewMessageBind"
If you send messages too quickly , I catch following exceptions messages.
2014-01-25T13:32:19+01:00 INFO (6): BinTreeNodeReader->readListSize: Invalid token 154 2014-01-25T13:32:20+01:00 INFO (6): BinTreeNodeReader->readListSize: Invalid token 5 2014-01-25T13:32:21+01:00 INFO (6): BinTreeNodeReader->readListSize: Invalid token 31 2014-01-25T13:32:22+01:00 INFO (6): BinTreeNodeReader->readListSize: Invalid token 79 2014-01-25T13:32:23+01:00 INFO (6): BinTreeNodeReader->readListSize: Invalid token 180
Hello, does somebody know why do I get this?
PHP Fatal error: Call to undefined method WhatsProt::Message() in /var/whatsapp/whatsapp_whatsapi_send.php on line 14
It's because your code is horribly outdated. Method names were changed like a year ago?
From time to time I keep getting this error:
What is causing this and how can I fix this?