Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I downloaded the library https://github.com/mgp25/Chat-API. This API 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, on my phone received a message with the code for registration. Next, I wrote the following script:

<?php
    require_once 'src/Registration.php';

    $debug = true;
    $username = '123456789';

    $w = new Registration($username, $debug);

    $w->codeRegister('654321'); //сode, that I have received
?>

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 login:

<?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. Function loginWithPassword() is in file whatsprot.class.php:

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

On line 277. On line 287 calls function doLogin(). This function in file Login.php :

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

On line 24. On line 49 is infinite loop. The same problem described here https://github.com/mgp25/Chat-API/issues/2140

like image 455
Julia Kovalenko Avatar asked Sep 23 '16 07:09

Julia Kovalenko


1 Answers

Unfortunately, I think whatsapp is no longer supporting this api

like image 132
Daniel Raouf Avatar answered Sep 20 '22 18:09

Daniel Raouf