2016-08-31 11 views
0

openfireからチャットルームを作成しました。 openfire.forからチャットルームを削除する必要があります。これはカールの助けを借りてREST APIプラグインを使用しています。 私は以下のコードを試しましたが、これではうまくいきませんでした。私は ドキュメントをopenfireの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プラグインを使用して

コードは、私はまた、RESTのAPIドキュメント https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#examples-20

を参照している、事前に おかげで私を助けてください。

答えて

関連する問題