PHP code example of dustler / hipchat
1. Go to this page and download the library: Download dustler/hipchat 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/ */
dustler / hipchat example snippets
use HipChat\Api;
$token = 'YourTokenKey';
$client = new HipChat\Http\Curl($token, HipChat\Api::DEFAULT_TARGET, 'v2');
$hc = new HipChat\Api($client);
// list rooms
foreach ($hc->getRoomRepo()->getRooms() as $room) {
echo "$room->id = $room->name\n";
}
var_dump($hc->getRoomRepo()->testToken('My room'));
$hc->getRoomRepo()->messageRoom('My room', 'Hello from sdk');
foreach ($hc->getUserRepo()->getUsers() as $user) {
echo "$user->id = $user->name".PHP_EOL;
}
$hc->getUserRepo()->messageUser('SomeUser', 'Hello from sdk');
$hc->getRoomRepo()->getRoomHistory('My room');