Home > DeveloperSection > Forums > How to register user on ejabberd using php ?
Tarun Kumar

Total Post:213

Points:1635
Posted on    April-21-2016 8:32 AM

 erlang OTP  erlang 
Ratings:


 1 Reply(s)
 560  View(s)
Rate this:
I am working on ChattApp, I want to register users in PHP.
I google it but can't find correct solution.
Please help me.


Sunil Singh
Sunil Singh

Total Post:11

Points:77
Posted on    April-21-2016 8:39 AM

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);
}

Don't want to miss updates? Please click the below button!

Follow MindStick