2016-04-27 53 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,該等待用戶輸入。