I downloaded the library https://github.com/mgp25/Chat-API . This API is whatsapp. I do everything as written in the documentation (github.com/mgp25/Chat-API/wiki).
First, I wrote the following script:
<?php require_once 'src/Registration.php'; $debug = true; $username = '123456789'; //my phone number $w = new Registration($username, $debug); $w->codeRequest('sms'); ?>
Then a message was received on my phone with a registration code. Then I wrote the following script:
<?php require_once 'src/Registration.php'; $debug = true; $username = '123456789'; $w = new Registration($username, $debug); $w->codeRegister('654321');
In response, I received:
[status] => ok [login] => login [pw] => password [type] => existing [expiration] => 1443256747 [kind] => free [price] => 39.0 [cost] => 0.89 [currency] => [price_expiration] => 1414897682
Next, I try to log in:
<?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);
Here the script goes into an infinite loop. The loginWithPassword () function is in the whatsprot.class.php file:
github.com/mgp25/Chat-API/blob/master/src/whatsprot.class.php
Line 277. Line 287 calls the doLogin () function. This function in the Login.php file:
github.com/mgp25/Chat-API/blob/master/src/Login.php
Line 24. Line 49 has an infinite loop. Same issue described here https://github.com/mgp25/Chat-API/issues/2140
source share