Example #1
0
    // 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;
    private $connected;
    private $waGroupList;
    public function __construct(array $config)