为什么Chat-Api会出现无限循环?

问题描述 投票:0回答:1

我下载了该库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

php whatsapp
1个回答
2
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.