本文整理汇总了PHP中WhatsProt::sendGetRequestLastSeen方法的典型用法代码示例。如果您正苦于以下问题:PHP WhatsProt::sendGetRequestLastSeen方法的具体用法?PHP WhatsProt::sendGetRequestLastSeen怎么用?PHP WhatsProt::sendGetRequestLastSeen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WhatsProt
的用法示例。
在下文中一共展示了WhatsProt::sendGetRequestLastSeen方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
}
$line = fgets_u(STDIN);
if ($line != '') {
if (strrchr($line, ' ')) {
$command = trim(strstr($line, ' ', true));
} else {
$command = $line;
}
switch ($command) {
case '/query':
$dst = trim(strstr($line, ' ', false));
echo "[] Interactive conversation with {$contact}:\n";
break;
case '/lastseen':
echo "[] Last seen {$target}: ";
$w->sendGetRequestLastSeen($target);
break;
default:
$w->sendMessage($target, $line);
break;
}
}
}
class ProcessNode implements NewMsgBindInterface
{
protected $wp = false;
protected $target = false;
public function __construct($wp, $target)
{
$this->wp = $wp;
$this->target = $target;
示例2: trim
$line = fgets_u(STDIN);
if ($line != "") {
if (strrchr($line, " ")) {
// needs PHP >= 5.3.0
$command = trim(strstr($line, ' ', TRUE));
} else {
$command = $line;
}
switch ($command) {
case "/query":
$dst = trim(strstr($line, ' ', FALSE));
echo "[] Interactive conversation with {$dst}:\n";
break;
case "/lastseen":
echo "[] Request last seen {$dst}: ";
$wa->sendGetRequestLastSeen($dst);
break;
default:
echo "[] Send message to {$dst}: {$line}\n";
$wa->sendMessage($dst, $line);
break;
}
}
}
exit(0);
}
if ($_SERVER['argv'][1] == "-l") {
echo "\n[] Listen mode:\n";
while (TRUE) {
$wa->pollMessages();
$data = $wa->getMessages();
示例3: onGetProfilePicture
// extract the remaining seconds
$remainingSeconds = $minuteSeconds % $secondsInAMinute;
$seconds = ceil($remainingSeconds);
// return the value
if ($seconds == null & $minutes == null & $hours == null & $days == null) {
echo "El contacto tiene desactivado esta función";
} else {
if ($seconds == 0 & $minutes == 0 & $hours == 0 & $days == 0) {
echo "En línea";
} else {
echo $days . " días " . $hours . " horas " . $minutes . " minutos";
}
}
}
$w->eventManager()->bind('onGetRequestLastSeen', 'onGetRequestLastSeen');
$w->sendGetRequestLastSeen($contacts);
//This function only needed to show how eventmanager works.
function onGetProfilePicture($from, $target, $type, $data)
{
if ($type == "preview") {
$filename = "preview_" . $target . ".jpg";
} else {
$filename = $target . ".jpg";
}
$filename = WhatsProt::PICTURES_FOLDER . "/" . $filename;
$fp = @fopen($filename, "w");
if ($fp) {
fwrite($fp, $data);
fclose($fp);
}
echo '<a href="' . $filename . '"><center><img src="' . $filename . '" height="250" width="250"></center></a><br><br>';
示例4: Tracker
echo "====================================================\n";
echo " WhatsApp tracker v0.1 \n";
echo "====================================================\n\n";
echo "[*] Logging in as WhatsApp Tracker ({$sender})\n";
$wa = new WhatsProt($sender, 'WhatsApp Tracker', FALSE);
$wa->connect();
$wa->loginWithPassword($password);
$events = new MyEvents($wa);
$wa->eventManager()->bind('onGetRequestLastSeen', 'onGetRequestLastSeen');
$wa->eventManager()->bind("onPresenceAvailable", "onPresenceAvailable");
$wa->eventManager()->bind("onPresenceUnavailable", "onPresenceUnavailable");
if ($_SERVER['argv'][1] == "-cRemote0" || $_SERVER['argv'][1] == "-check") {
echo "\n[-] Tracker mode (ON):\n";
while (TRUE) {
if ($_SERVER['argv'][1] == "-check") {
$wa->sendGetRequestLastSeen($dst);
} else {
$wa->sendGetRequestLastSeen($_SERVER['argv'][3]);
$wa->sendMessage($dst, "(" . $_SERVER['argv'][3] . ") " . $ls);
}
sleep(60);
}
}
if ($_SERVER['argv'][1] == "-cHidden" || $_SERVER['argv'][1] == "-cRemote1") {
echo "\n[-] Tracker mode (ON): Waiting the user to get online...\n";
$wa->SendPresenceSubscription($dst);
$wa->pollMessage();
if ($presence == "available") {
echo "- The user is now online\n\n";
} else {
echo "- The user is offline\n\n";