venomous0x / WhatsAPI

Interface to WhatsApp Messenger
2.6k stars 2.13k forks source link

Can't receive messages #1052

Open LukasvdDijssel opened 9 years ago

LukasvdDijssel commented 9 years ago

Hello,

I am trying to use WhatsAPI after not using it for a year or so. Currently, I have this code:

<?php
set_time_limit(0);
require_once '../src/whatsprot.class.php';

date_default_timezone_set('Europe/Amsterdam');

$username = "31612345678";
$password = "redacted";
$identity = "redacted";
$nickname = "WhatsApp Bot";
$target = "31687654321";

$w = new WhatsProt($username, $identity, $nickname, true);

function getMessage($mynumber, $from, $id, $type, $time, $name, $body) {
    echo "Message from $name:\n$body\n\n";
}

$w->eventManager()->bind("onGetMessage", "getMessage");

$w->connect();

$w->loginWithPassword($password);

$w->sendSetProfilePicture('pf.jpg');
$w->sendStatusUpdate('I am a robot.');

while($w->PollMessage());

I can send messages and I do get a working profile picture and all that, but I won't receive my messages. Not by using the above code (which stops after a few seconds unless I put PollMessage in an infinite loop), or manually using GetMessages in an infinite loop. I have noticed some weird characters all over the debug code:

tx  <stream:features></stream:features>

tx  <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="WAUTH-2" user="316
12345678">┬>zç31612345678·∟ß│°¬öèµ▓r~ß]╠äΦ♂1418667283WhatsApp/2.11.473 Android/4
.3 Device/GalaxyS3 MccMnc/204001</auth>

rx  <start from="s.whatsapp.net"></start>

rx  <stream:features></stream:features>

rx  <challenge>ñª▐╟╨╟☺i╒Nû╧e½jcÿüτ≤</challenge>

tx  <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">εYc╔)≥Æ←τXs▐τσ↔╬v─ï\K·¢√♣
H
Q▌§^UR⌠☻</response>

rx  <success t="1418667283" props="4" kind="free" status="active" creation="1332
962876" expiration="1429186737">+█jê0á:╤{╙╫╘,v2Æ╣♣╒4</success>

tx  <presence name="WhatsApp Bot"></presence>

tx  <iq id="setphoto-1418667283-1" to="31612345678@s.whatsapp.net" type="set" xm
lns="w:profile:picture">
tx    <picture> 6419 byte data</picture>
tx    <picture type="preview"> 2221 byte data</picture>
tx  </iq>

rx  <message from="31687654321@s.whatsapp.net" id="1418661434-23" offline="0" ty
pe="text" t="1418665560" notify="L.">
rx    <enc v="1" type="msg" av="Android/2.11.432">3
!♣Ç3¿b8╒X°òY)ⁿTI*(↑«∞qS╣└2↨╢δ←¥-G►←↑ "►╥╬Ç╗á$1▄▬Ñ ├╫♣D▐EαxT∩¥┬/</enc>
rx  </message>

rx  <message from="31687654321@s.whatsapp.net" id="1418661434-24" offline="0" ty
pe="text" t="1418665742" notify="L.">
rx    <enc v="1" type="msg" av="Android/2.11.432">3
!♣Ç3¿b8╒X°òY)ⁿTI*(↑«∞qS╣└2↨╢δ←¥-G►∟↑ "►φ2NµΘl╠Ç╪U0 µ↨ªú 0╟→¶¬┐;</enc>
rx  </message>

rx  <message from="31687654321@s.whatsapp.net" id="1418661434-25" offline="0" ty
pe="text" t="1418665756" notify="L.">
rx    <enc v="1" type="msg" av="Android/2.11.432">3
!♣Ç3¿b8╒X°òY)ⁿTI*(↑«∞qS╣└2↨╢δ←¥-G►↔↑ "►'K╧9┌o{u[?¿ï╪RZÖH,Θŧ┴£</enc>
rx  </message>

rx  <message from="31687654321@s.whatsapp.net" id="1418661434-26" offline="0" ty
pe="text" t="1418665758" notify="L.">
rx    <enc v="1" type="msg" av="Android/2.11.432">3
!♣Ç3¿b8╒X°òY)ⁿTI*(↑«∞qS╣└2↨╢δ←¥-G►▲↑ "►¡σ███ñs,┼♂âàvÑ╡↑ìb¢▒è╪&é</enc>
rx  </message>

rx  <message from="31687654321@s.whatsapp.net" id="1418661434-27" offline="0" ty
pe="text" t="1418665759" notify="L.">
rx    <enc v="1" type="msg" av="Android/2.11.432">3
!♣Ç3¿b8╒X°òY)ⁿTI*(↑«∞qS╣└2↨╢δ←¥-G►▼↑ "►≤↓Å∞╨¡╧├►╠⌐┤Ü_Gªi╞é╞{Gz</enc>
rx  </message>

rx  <message from="31687654321@s.whatsapp.net" id="1418661434-28" offline="0" ty
pe="text" t="1418665898" notify="L.">
rx    <enc v="1" type="msg" av="Android/2.11.432">3
!♣Ç3¿b8╒X°òY)ⁿTI*(↑«∞qS╣└2↨╢δ←¥-G► ↑ "►4²♂ⁿ╘.   º←ù☼AºUtiòQ9s↕ÿP■</enc>
rx  </message>

rx  <message from="31687654321@s.whatsapp.net" id="1418661434-29" offline="0" ty
pe="text" t="1418665951" notify="L.">
rx    <enc v="1" type="msg" av="Android/2.11.432">3
!♣Ç3¿b8╒X°òY)ⁿTI*(↑«∞qS╣└2↨╢δ←¥-G►!↑ "►▀)ò▒♦║årp▼∟2d τ∙ûÿå_Ω|mⁿ</enc>
rx  </message>

rx  <message from="31687654321@s.whatsapp.net" id="1418661434-30" offline="0" ty
pe="text" t="1418665961" notify="L.">
rx    <enc v="1" type="msg" av="Android/2.11.432">3
!♣Ç3¿b8╒X°òY)ⁿTI*(↑«∞qS╣└2↨╢δ←¥-G►"↑ "►▲eΦ≥┐"╧t←i→ │ì0£<^╢┴∞L1┼</enc>
rx  </message>

rx  <message from="31687654321@s.whatsapp.net" id="1418661434-36" offline="0" ty
pe="text" t="1418666793" notify="L.">
rx    <enc v="1" type="msg" av="Android/2.11.432">3
!♣Ç3¿b8╒X°òY)ⁿTI*(↑«∞qS╣└2↨╢δ←¥-G►#↑ "►QÅ=╢╤C¢τC╒ⁿ, :Ä╙öµ8T↕µùª</enc>
rx  </message>

rx  <message from="31687654321@s.whatsapp.net" id="1418661434-37" offline="0" ty
pe="text" t="1418666820" notify="L.">
rx    <enc v="1" type="msg" av="Android/2.11.432">3
!♣Ç3¿b8╒X°òY)ⁿTI*(↑«∞qS╣└2↨╢δ←¥-G►$↑ "►æ¶▐ßσM S)↔u↕╟^╫3╝╖|z▐Wѵ</enc>
rx  </message>

rx  <message from="31687654321@s.whatsapp.net" id="1418661434-38" offline="0" ty
pe="text" t="1418666820" notify="L.">
rx    <enc v="1" type="msg" av="Android/2.11.432">3
Ñ╪Y     °↑4ä</enc>↑«∞qS╣└2↨╢δ←¥-G►%↑ "►§ïn#⌠É¿à◄d%9k≥╛
rx  </message>

rx  <ib from="s.whatsapp.net">
rx    <offline count="11"></offline>
rx  </ib>

rx  <presence from="31612345678@s.whatsapp.net"></presence>

rx  <presence from="31687654321@s.whatsapp.net" type="unavailable" last="1418667
244"></presence>

rx  <iq from="31612345678@s.whatsapp.net" id="setphoto-1418667283-1" type="resul
t">
rx    <picture id="1418667283"></picture>
rx  </iq>

tx  <iq to="s.whatsapp.net" type="set" id="sendstatus-1418667283-2" xmlns="statu
s">
tx    <status>I am a robot.</status>
tx  </iq>

rx  <iq from="s.whatsapp.net" id="sendstatus-1418667283-2" type="result"></iq>

I am running from the command line.

mgp25 commented 9 years ago

@Sydcul Use WhatsAPI Official repo instead: https://github.com/mgp25/WhatsAPI-Official

Wiki available

LukasvdDijssel commented 9 years ago

@mgp25 Is this one dead?

mgp25 commented 9 years ago

@Sydcul yes