mardi 4 août 2015

how to delete member from chat room xmpp server via php

I am trying to delete a member of chat room from XMPP server via php. I am using curl request for that.

I am following this documentation: http://ift.tt/1ImnAL8

$url = "http://ift.tt/1KNGMag".$roomName."/members/".$userJID;
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/xml", "Authorization : ******")); //I am using plugin.userservice.secret key here
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");    
    $json_response = curl_exec($curl);

        $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        curl_close($curl);

It should return me http response 201, but I am getting login form of server in response or 401 (unauthorized user).

I am trying to do this since last one week, but did not get any solution of this till, please help me.

Thanks in advance for your kind support.

Aucun commentaire:

Enregistrer un commentaire