2016-08-31 46 views
0

我已經從openfire創建了一個聊天室知道我必須從openfire刪除一個聊天室 ,因爲我已經使用REST api插件的捲曲幫助。 我已經嘗試了下面的代碼,但它不工作,爲此我也參考了openfire的REST api插件的 文檔,但我沒有得到我要去哪裏錯誤的地方,請指導我解決此問題。使用REST API插件刪除聊天室如何從PHP中的openfire刪除聊天室

<?php 

     $url1 = "http://ipaddress:9090/plugins/restapi/v1/chatrooms"; 

     $data1 = "<chatroom> 
    <roomname>test</roomname> 
    <servicename>conference</servicename> 
    </chatroom>"; 

     $username1 = "Adminconsoleusername"; 
     $password1 = "Adminconsolepassword"; 
     $ch1 = curl_init(); 
     curl_setopt($ch1, CURLOPT_URL, $url1); 
     curl_setopt($ch1, CURLOPT_PORT, "9090"); 
     curl_setopt($ch1, CURLOPT_POST, 1); 
     curl_setopt($ch1, CURLOPT_POSTFIELDS, $data1); 
     curl_setopt($ch1, CURLOPT_HTTPAUTH, CURLAUTH_ANY); 
     curl_setopt($ch1, CURLOPT_HTTPHEADER, array('Content-Type: application/xml', 'Authorization: Basic ' . base64_encode("$username1:$password1"))); 
     $code1 = curl_getinfo($ch1, CURLINFO_HTTP_CODE); 
     curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true); 
     //echo $code1; 
     $res1 = curl_exec($ch1); 
     //echo "code " . $code; 
     echo $res1; 
     print_r($res1); 

     curl_close($ch1); 

代碼,我也參考了REST API文檔 https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#examples-20

請幫助我, 先謝謝了。

回答