Example #1
0
    // Gets current cookies params.
    session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], false, true);
    session_name('wa_session');
    // Sets the session name to the one set above.
    session_start();
    // Start the php session
}
/**
 * Detect how the script was called. If it was POSTED too, we have
 * something to do, if it was just called via GET, we probably
 * only have to show the login page.
 */
$whatsapp = new Whatsapp($config);
if ($_SERVER['REQUEST_METHOD'] !== "POST") {
    if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] !== true) {
        exit($whatsapp->showWebLoginForm());
    }
}
$whatsapp->process();
class Whatsapp
{
    private $config;
    private $from;
    private $number;
    private $id;
    private $nick;
    private $password;
    private $contacts = array();
    private $inputs;
    private $messages;
    private $wa;