【发布时间】:2017-01-31 23:09:23
【问题描述】:
我下载了库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
【问题讨论】:
-
我也有同样的问题..希望有人能解决..