Esempio n. 1
0
 /**
  * @param $status
  * @return bool
  */
 public function updateStatus($status)
 {
     if (isset($status) && trim($status) !== '') {
         $this->connectToWhatsApp();
         $this->wa->sendStatusUpdate($status);
         return true;
     }
     return false;
 }
Esempio n. 2
0
                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();
        if (!empty($data)) {
            print_r($data);
        }
        sleep(1);
    }
    exit(0);
}
if ($_SERVER['argv'][1] == "-set") {
    echo "\n[] Setting status:\n";
    $wa->sendStatusUpdate($_SERVER['argv'][2]);
    exit(0);
}
echo "\n[] Request last seen {$dst}: ";
$wa->sendGetRequestLastSeen($dst);
echo "\n[] Send message to {$dst}: {$msg}\n";
$wa->sendMessage($dst, $msg);
echo "\n";
Esempio n. 3
0
$username = $argv[1];
$password = $argv[2];
$nickname = $argv[3];
$identity = $argv[4];
$method = $argv[5];
$args = $argv[6];
$targets = $argv[7];
echo "Username: "******"\r\n";
echo "Password: "******"\r\n";
echo "Nickname: " . $nickname . "\r\n";
echo "Identity: " . $identity . "\r\n";
echo "Method: " . $method . "\r\n";
echo "Args: " . $args . "\r\n";
$w = new WhatsProt($username, $identity, $nickname, true);
$w->connect();
$w->loginWithPassword($password);
if ($method == "sendStatusUpdate") {
    echo "About to send status update.\r\n";
    $w->sendStatusUpdate($args);
} elseif ($method == "sendProfilePicture") {
    echo "About to send profile picture.\r\n";
    $w->sendSetProfilePicture($args);
} elseif ($method == "broadcastMessage") {
    $targets = explode(",", $targets);
    echo "About to broadcast a message.\r\n" . print_r($targets) . "\r\n";
    $w->sendBroadcastMessage($targets, $args);
} elseif ($method == "sendBroadcastImage") {
    $targets = explode(",", $targets);
    $w->sendBroadcastImage($targets, $args, false);
}
sleep(5);
Esempio n. 4
0
     break;
 case '/contacts':
     $show = true;
     break;
 case '/status':
     echo "\nEnter your status > ";
     $status = trim(fgets(STDIN));
     do {
         echo "\nIs it right yes/no > ";
         $check = trim(fgets(STDIN));
         if ($check != 'yes') {
             echo "\nEnter your status > ";
             $status = trim(fgets(STDIN));
         }
     } while ($check != 'yes');
     $w->sendStatusUpdate($status);
     break;
 case '/profile':
     echo "\nEnter your profile picture URL > ";
     $profile = trim(fgets(STDIN));
     do {
         echo "\nIs it right yes/no > ";
         $check = trim(fgets(STDIN));
         if ($check != 'yes') {
             echo "\nEnter your profile picture URL > ";
             $profile = trim(fgets(STDIN));
         }
     } while ($check != 'yes');
     if (!filter_var($profile, FILTER_VALIDATE_URL) === false) {
         if (@getimagesize($profile) !== false) {
             $w->sendSetProfilePicture($profile);