-2

我用谷歌搜索了很多,但没有找到一个答案......!

我正在使用 whatsapi 通过 PHP 发送消息。

但是,当我执行包括 loginwithpassword() 或 sendmessage() 在内的任何函数时,它会输出以 tx 开头的行的响应。我想将 api 集成到我的网站中,并将某些输入自动发布到我的一些 Whatsapp 组。

我使用以下代码

$username = "91xxxxxxxx"; //Mobile Phone prefixed with country code so for india it will be 91xxxxxxxx
$password = "Password";
$identity = strtolower(urlencode(sha1($username, true)));
$w = new WhatsProt($username, $identity, "WhatsApp Messaging", true); //Name your application by replacing "WhatsApp Messaging"
$w->connect();
$w->loginWithPassword($password);

$phone="91xxxxxxxxxxx";

$w->eventManager()->bind("onGetGroups", "onGetGroups");
$w->sendGetGroups();

function onGetGroups($phone,$groups)
{
echo "<form action='' method='POST'>";

foreach($groups as $gr){

    echo "<input type='checkbox' name='gids[]' value='$gr[id]'>$gr[id] ->   $gr[subject]<br>";
}
echo "<textarea name='msg' rows='10' cols='40'></textarea>";
echo "<input type='submit' name='gmsub' value='Send Group Message'>";
echo "</form>";


}

if(isset($_POST['gmsub'])){
$msg=$_POST['msg'];
$groupc=$_POST['gids'];

$total=count($groupc);
    for($i=0;$i<$total;$i++){
        $gId=$groupc[$i];

        $w->sendMessage($gId, $msg);
    }
}

我不希望屏幕上出现如下输出...

tx  <stream:features>
tx    <readreceipts></readreceipts>
tx    <groups_v2></groups_v2>
tx    <privacy></privacy>
tx    <presence></presence>
tx  </stream:features>

tx  <auth mechanism="WAUTH-2" user="91xxxxxxxxxx">&£ºƒ91xxxxxxxxxn•Vv^¹ðÁ2EÎòƒ³oΡ1447256662</auth>

rx  <start from="s.whatsapp.net"></start>

rx  <stream:features></stream:features>

rx  <challenge>œÇÚ‰C¹WŒ™`¼%1Á™&lt;/challenge>

tx  <response>ó gÏD’—!°¶µpOðµ³ @³XH2înÆ/•[r</response>

rx  <success t="1447256780" props="4" kind="free" status="active" creation="1413023053" expiration="1476095053">9Ož¦n»ÃFáG¨È{'sÊM‚&lt;/success>

.................etc 

我只想在屏幕上输出我想要的东西。如何抑制屏幕上的 tx 和 rx 输出?!

4

1 回答 1

1

false通过更改第一行中的最后一个参数而不是关闭调试模式true

于 2015-11-21T05:49:15.827 回答