Ejemplo n.º 1
0
$w->sendGetProfilePicture($target, true);
echo "[*] Connected to WhatsApp\n\n";
//update your profile picture
//$w->sendSetProfilePicture("demo/foglet.jpg");
//send picture
//$w->sendMessageImage($target, "demo/foglet.jpg");
$w->sendMessage($target, "Guess the number :)");
$pn = new ProcessNode($w, $target);
$w->setNewMessageBind($pn);
while (!file_exists("stopRunning")) {
    while ($w->pollMessage()) {
    }
    /*
    	$messages = $w->getMessages();
    
    	foreach ($messages as $message){
    		$from = $message->getAttribute("from");
    		if($message->getChild("body")){
    			$body = $message->getChild("body")->getData();
    			echo 'this is body '.$body;
    		}
    
    	}
    */
    $w->sendPresence();
    if (file_exists("/whatsapp/stopRunning")) {
        $whatsApp->disconnect();
    }
}
$connection->close();
unlink("/whatsapp/stopRunning");