为什么在Chat-Api中有一个无限循环


Why is there an infinite loop in the Chat-Api?

我下载了库https://github.com/mgp25/Chat-API。这个API whatsapp。我所做的一切都是按照文档(github.com/mgp25/Chat-API/wiki)中所写的。

首先,我写了下面的脚本:

<?php 
    require_once 'src/Registration.php';
    $debug = true;
    $username = '123456789'; //my phone number
    $w = new Registration($username, $debug);
    $w->codeRequest('sms');
?>

然后,我的手机收到了一条带有注册代码的信息。接下来,我编写了以下脚本:

<?php
    require_once 'src/Registration.php';
    $debug = true;
    $username = '123456789';
    $w = new Registration($username, $debug);
    $w->codeRegister('654321'); //сode, that I have received
?>

作为回应,我收到:

  [status] => ok
  [login] => login
  [pw] => password
  [type] => existing
  [expiration] => 1443256747
  [kind] => free
  [price] => 39.0
  [cost] => 0.89
  [currency] => руб
  [price_expiration] => 1414897682

接下来,我尝试登录:

<?php
    set_time_limit(10);
    require_once 'src/whatsprot.class.php';
    require_once 'src/events/MyEvents.php';
    date_default_timezone_set('Europe/Moscow');
    $username = '123456789';                 
    $password = 'password';
    $nickname = 'nickname';                    
    $debug    = true;
    $w = new WhatsProt($username, $nickname, $debug);
    $w->connect();
    $w->loginWithPassword($password);

在这里,脚本进入一个无限循环。函数loginWithPassword()在文件whatsprot.class.php:

    github.com/mgp25/Chat-API/blob/master/src/whatsprot.class.php

在277行。在第287行调用函数doLogin()。文件Login.php中的函数:

    github.com/mgp25/Chat-API/blob/master/src/Login.php

在第24行。第49行是无限循环。这里描述的相同问题https://github.com/mgp25/Chat-API/issues/2140

不幸的是,我认为whatsapp不再支持这个api