How to integrate html5 chat into phpfox

How to integrate html5 chat into phpfox ?

step 1: download the phpfox module here

step 2 : open file


and edit these lines 16-17

$webmasterid = xxxx; // ENTER your script id (webmasterid) here
$password = 'my secret password'; // ENTER your HTML5 password here

and fill with your own data

step3: open your website

You will be loggedon with your username, gender, avatar and role


JWT: a quicker and simpler version using the HTML5 service

Here is a quicker and simpler version of integrating  HTML5 chat into an existing website than the JWT version described in that post

The bottom sample is a php sample, but you can easily adapt it to JS or ASP in needed

Step 1: you create an array of your user such as:

$json = json_encode(array(
    'username'  =>'myUsername',
    'password'  =>'myChatAccountPassword',
    'gender'    =>'male',
    'role'      =>'user',
    'image'     =>base64_encode(''),
    'profile'   =>''

Step 2 : you encode it using the html5 JWT online service

$encoded = file_get_contents("".base64_encode($json));

Step 3 : you inject that encoded string into your JS script

<script src="<?=webmasterid?>/<?=$encoded?>"></script>

And that’s ALL:

role : can be admin,  user, guest,  dj, custom1, custom2, custom3

avatar is the http:// image of the expected avatar

profile: the link to the user profile (if available)

startRoom : the id of the room where to start in (roomid is an integer number)

Replace the webmasterid in script by your script id (webmasterid, a positive integer you can find in your chatadmin panel)

If you want to use JWT on your server, please refer to this post.

<?php $json = json_encode(array('username'=>'myUsername', 'password'=>'myPassword', 'gender'=>'male', 'role'=>'user', 'profile'=>'', 'image'=>''));
$encoded = file_get_contents("".base64_encode($json), 'startRoom'=>5);
<!doctype html>
<html lang="en">
    <meta charset="UTF-8">
    <title>HTML5 chat</title>

<div style="width: 1024px;height: 800px;">
    <script src="<?=$encoded?>"></script>


Notice: if file_get_contents is DISABLED on your hosting, you can use the curl

$curl= curl_init();
curl_setopt_array($curl, array(
      CURLOPT_URL => "".base64_encode($json)
$encoded = curl_exec($curl);