---
title: "How to register user on ejabberd using php ?"  
description: "How to register user on ejabberd using php ?"  
author: "Tarun Kumar"  
published: 2016-04-21  
updated: 2018-02-28  
canonical: https://www.mindstick.com/forum/34110/how-to-register-user-on-ejabberd-using-php  
category: "erlang"  
tags: ["otp", "erlang"]  
reading_time: 1 minute  

---

# How to register user on ejabberd using php ?

I am working on ChattApp, I want to [register](https://www.mindstick.com/blog/220/registering-client-script-in-asp-dot-net) [users](https://www.mindstick.com/news/2244/issue-preventing-users-from-accessing-facebook-s-social-networking-platforms-has-been-resolved) in PHP.\
I [google](https://www.mindstick.com/articles/43833/google-lighthouse-and-how-is-it-changing-the-way-we-development-and-design-websites) it but can't find correct solution.\
Please help me.\

## Replies

### Reply by Eirlys Lee

Post is removed by the Admin.

### Reply by Abdelhafid DAHHANI

Hii

hope you are well

it doesn't work for me this code !!

"message": "User Notice: xmlrpc: Error -118\nA problem '{error,access_rules_unauthorized}' occurred executing the command register with arguments\n[{user,<<\"ok\">>},{host,<<\"localhost\">>},{password,<<\"ok\">>}] (-118)",\

### Reply by Sunil Singh

try this code

```
$param=array("user"=>"testusername","host"=>"testserver.com","password"=>"test");$request = xmlrpc_encode_request('register', $param, (array('encoding' => 'utf-8')));$context = stream_context_create(array('http' => array(    'method' => "POST",    'header' => "User-Agent: XMLRPC::Client mod_xmlrpc\r\n" .                "Content-Type: text/xml\r\n" .                "Content-Length: ".strlen($request),    'content' => $request)));$file = file_get_contents("http://192.168.1.199:4560/", false, $context);$response = xmlrpc_decode($file);if (xmlrpc_is_fault($response)) {    trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");} else {    print_r($response);}
```


---

Original Source: https://www.mindstick.com/forum/34110/how-to-register-user-on-ejabberd-using-php

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
