PHP code example of yoji / rocket-chat
1. Go to this page and download the library: Download yoji/rocket-chat library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yoji / rocket-chat example snippets
// Firstly, init
\ATDev\RocketChat\Chat::setUrl("http://chat.me"); // No trailing /
// Now, login
$result = \ATDev\RocketChat\Chat::login("[USER LOGIN]", "[USER PASSWORD]");
if (!$result) {
// Log the error
$error = \ATDev\RocketChat\Chat::getError();
}
$who = \ATDev\RocketChat\Chat::me();
if (!$who) {
// Log the error
$error = \ATDev\RocketChat\Chat::getError();
}
\ATDev\RocketChat\Chat::logout();