HOW TO REGISTER USER ON EJABBERD USING PHP ?

Tarun Kumar

Total Post:214

Points:1642
Posted by  Tarun Kumar
OTP  erlang 
 1304  View(s)
Ratings:
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.
  1. Sunil Singh

    Post:25

    Points:177
    Re: How to register user on ejabberd using php ?

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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!