PHP code example of viper-vlad / rocket-chat-php-wrapper
1. Go to this page and download the library: Download viper-vlad/rocket-chat-php-wrapper 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/ */
viper-vlad / rocket-chat-php-wrapper 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();