2016-04-27 92 views
0

我正在使用WhatsApp Chat-API。 对于注册过程,我遵循 Documentation提供的文档。WhatsApp chat-api注册过程错误

所以注册过程中,我使用下面的代码

$username = "mynumber"; 
$debug = true; 
$r = new Registration($username, $debug); 
$r->codeRequest('sms'); 

现在到这里,我得到验证的味精,但问题是我如何可以使用的代码,手机作为下一行收到的代码为如下

$code = '123456';// this is hard coded in documentation how i can use my verification code which i received on my phone 
$r->codeRegister($code); 

所以在获取验证码后,我如何使用上面的代码获取登录密码?

回答

0

我所做的是在第一次运行期间将$r->codeRegister($code)注释掉。然后我等待WhatsApp发送代码。当我在手机上获得代码时,我使用WhatsApp API发送的代码将$r->codeRequest('sms') and uncomment $ r-> codeRegister($ code); replacing $ code`注释掉。

这是一个陈腐的做法,但它的工作原理。

理想情况下,您应该从STDIN获得$code,该等待用户输入。