【问题标题】:Whatsapp API php code requestWhatsapp API php 代码请求
【发布时间】:2023-03-07 04:36:02
【问题描述】:

以下是我的 CodeRequest 代码。

$username = "91xxxxxxxxxx";   
$identity = strtolower(urlencode(sha1($username, true)));
$w = new WhatsProt($username, $identity, "test", true);
$r = $w->codeRequest();

print_r($r);

它给出的响应为

stdClass Object ( [status] => sent [length] => 6 [method] => sms [retry_after] => 1805 )

但我没有收到消息。请有任何建议。

我的其他问题。

  1. 请求代码有什么限制吗(每次我用新的手机号)。?
  2. 例如,我使用用户代理 galaxys3 请求手机号码 xxx 的代码,我是否应该使用相同的用户代理请求手机号码 yyy 的另一个代码?

我正在使用WhatsAPI-Official

【问题讨论】:

  • 你能告诉我你是如何从whatsapp获取密码的吗?我的意思是在windows操作系统中,我们可以通过哪种方式获取whatsapp的密码……
  • 使用codeRegister(verificationcode)函数获得确认/验证码后,即可获得密码。
  • 我使用的 api 与你使用的相同。当我在示例文件夹中运行 whatsapp.php 时,我收到类似 Parse error: parse error in G:\wamp\www\ 的错误WhatsAPI\src\WhatsAppEvent.php 在第 105 行...我不确定我必须先运行哪个文件
  • OK.. 你必须在示例文件夹中运行exampleRegister.php 文件更改你的用户名、身份和昵称。
  • 你如何获得identity变量的值..

标签: php whatsapp


【解决方案1】:

我终于收到了手机代码。

$username = "91xxxxxxxxxx";   
$identity = "myIdentity";
$w = new WhatsProt($username, $identity, "test", true);
$r = $w->codeRequest('sms',$carrier); 
(or)
$r = $w->codeRequest('voice',$carrier);   //Voice service is fast compared to sms

$carrier 正在从 networkinfo.csv 文件中获取。

根据您的移动国家代码 (mcc) 和移动网络代码 (mnc),运营商只不过是移动网络运营商(Airtel、Idea 等)。

您可以从mobile-network-codes-country-codes获取mnc和mcc代码

获取您所在位置和操作的 mcc 和 mnc 代码,将它们与 networkinfo.csv 匹配以获取 carrier 名称。

Eg: My number is 919xxxxxx
    country -  india ( Andhra Pradesh )
    operator - Idea

对于上面的链接 mcc 和 mnc 是我的号码是404 & 7

现在检查networkinfo.csv文件中的那些代码

404,1028,007,7,in,India,91,Idea Cellular Ltd.4

这里404 -> mcc007 -> mnc

我的运营商名称是Idea Cellular Ltd.4

如果您发送正确的运营商名称,您将收到短信/电话到手机。

【讨论】:

  • 如何获取$identity?这行得通吗? => strtolower(urlencode(sha1($username, true)));
  • 我为身份提供了静态文本,例如$identity = "myIdentity"。以前我使用urlencode 方法,但它对我不起作用。
【解决方案2】:

试试这段代码。

    $destinationPhone = 'xxxxxxxxxxxx';
    $w = new WhatsProt($userPhone, $userIdentity, $userName, $debug);
    $w->Connect();
    $w->LoginWithPassword($password);
    $w->Message($destinationPhone, $argv[1]);

或更多信息请参阅此链接.. http://blog.philippheckel.com/2013/07/07/send-whatsapp-messages-via-php-script-using-whatsapi/#Send-WhatsApp-messages

【讨论】:

  • 我问的是请求代码而不是发送消息。
猜你喜欢
  • 2013-02-28
  • 1970-01-01
  • 2015-12-31
  • 1970-01-01
  • 1970-01-01
  • 2011-05-27
  • 2013-05-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多