In real time chat via openfire, create openfire user using PHP, PHP call rest API to openfire for creating a user, Openfire user management using PHP for that you need to install User Service Plugin.
Install User Service Plugin
1. After installation in use secret from the plugin
2. Make sure PHP extension CURL is enabled.
3. Write below code in PHP file with your secret and your IP (or hostname)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
//Plugin secret $secret = "V7yl4cp0"; //Unique username,if username repeat then not work api $username = "6"; //Password - any string $password = "drowssap"; // Display name of user $name = "Bill"; // Useremail $email = 'franz@kafka.com'; //Your ip or hostname $host_name = "http://127.0.0.1:9090"; $url = $host_name . '/plugins/userService/userservice?type=add&secret=' . $secret; $url.='&username=' . $username . '&password=' . $password . '&name=' . $name . '&email=' . $email; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($curl); curl_close($curl); $p = xml_parser_create(); xml_parse_into_struct($p, $data, $vals, $index); xml_parser_free($p); //$vals=response of openfire print_r($vals); |
More Stories
PHP Composer memory limit issues
Connect to a server with cURL over SSL
Text to speech