// password // konek ------------------------------------------------------------------------------------------------------------ echo "+ Login sebagai {$nickname} ({$username})\n+\n"; $w = new WhatsProt($username, $nickname, $debug); sleep(3); $w->connect(); $w->loginWithPassword($password); $w->sendGetServerProperties(); $w->sendClientConfig(); $w->sendGetGroups(); $w->sendPing(); // kirim pesan ke nomor tujuan -------------------------------------------------------------------------------------- $target = "62xxxxxxxxxxx"; $pesan = "Halo Dunia!"; echo "+ Mengirim pesan\n"; echo "+ target : {$target}\n"; echo "+ pesan : {$pesan}\n+\n"; $w->sendMessageComposing($target); // typing.. sleep(3); $w->sendMessagePaused($target); // selesai typing sleep(1); $w->sendMessage($target, $pesan); // kirim pesan $w->pollMessage(); sleep(1); $w->pollMessage(); sleep(1); $w->pollMessage(); echo "+ Selesai\n+\n";
} */ if ($line != '') { if (strrchr($line, ' ')) { $command = trim(strstr($line, ' ', true)); } else { $command = $line; } switch ($command) { case '/current': $nickname = findNicknameByPhone($contact); echo "[] Interactive conversation with {$nickname}:\n"; break; case '/lastseen': echo "[] Last seen {$contact}: "; $w->sendMessagePaused($contact); $compose = true; $w->sendPresenceSubscription($contact); break; case '/sendimage': echo "\nEnter the URL or path of the image > "; $filepath = trim(fgets(STDIN)); echo "\nSay something about the image > "; $caption = trim(fgets(STDIN)); $target = $contact; $w->sendMessageImage($target, $filepath, false, $fsize, $fhash, $caption); $w->pollMessage(); break; case '/sendvideo': echo "\nEnter the URL or path of the video > "; $filepath = trim(fgets(STDIN));