-2

私はこれを何度もグーグルで検索しましたが、答えが1つも見つかりませんでした....!

PHPでメッセージを送信するためにwhatsapiを使用しています。

ただし、loginwithpassword() または sendmessage() を含む関数のいずれかを実行すると、tx で始まる行で応答が出力されます。API を Web サイトに統合し、特定の入力をいくつかの 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の代わりに最初の行の最後のパラメーターを変更して、DEBUG モードをオフにします。true

于 2015-11-21T05:49:15.827 に答える