Tools.php
public static function sendHipChatMessage($room, $token, $text, $notify = true, $format = 'text')
    {
        $session = curl_init();
        curl_setopt($session, CURLOPT_URL, 'https://api.hipchat.com/v2/room/' . $room . '/notification?auth_token=' . $token);
        curl_setopt($session, CURLOPT_POST, 1);
        curl_setopt(
            $session,
            CURLOPT_POSTFIELDS,
            http_build_query(
                [
                    'message' => $text,
                    'message_format' => $format,
                    'notify' => $notify,
                ]
            )
        );

        curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
        curl_exec($session);
        curl_close($session);
    }
public static function sendHipChatMessage($room, $token, $text, $notify = true, $format = 'text')
    {
        $session = curl_init();
        curl_setopt($session, CURLOPT_URL, 'https://api.hipchat.com/v2/room/' . $room . '/notification?auth_token=' . $token);
        curl_setopt($session, CURLOPT_POST, 1);
        curl_setopt(
            $session,
            CURLOPT_POSTFIELDS,
            http_build_query(
                [
                    'message' => $text,
                    'message_format' => $format,
                    'notify' => $notify,
                ]
            )
        );

        curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
        curl_exec($session);
        curl_close($session);
    }
public static function sendHipChatMessage ( $ room , $ token , $ text , $ notify = true , $ format = 'text' ) { $ session = curl_init ( ) ; curl_setopt ( $ session , CURLOPT_URL , 'https://api.hipchat.com/v2/room/' . $ room . '/notification?auth_token=' . $ token ) ; curl_setopt ( $ session , CURLOPT_POST , 1 ) ; curl_setopt ( $ session , CURLOPT_POSTFIELDS , http_build_query ( [ 'message' => $ text , 'message_format' => $ format , 'notify' => $ notify , ] ) ) ; curl_setopt ( $ session , CURLOPT_RETURNTRANSFER , true ) ; curl_exec ( $ session ) ; curl_close ( $ session ) ; }
Send message to HipChat room

@param string $room Room name or ID
@param string $token Token
@param string $text Message body
@param bool $notify Determine if should notify users
@param string $format Format of message
Send message to HipChat room