我正在研究服务器端的聊天应用程序,其中一对一和群聊是模块。
I am able to create the new room for the group chat.
But i am unable to invite the friends to that group using php code.
if somebody has sample code that would be great..
I write below code for sending invitation to user for that group but it is not working for sending invitation to user and it also not throw any kind of Exception.As above i have describe i am working on chat application in which i have to send invitation so that device side developer can used this invitation and call the web api for refreshing the list automatically.
<?php
$url = "http://host:port/plugins/mucservice/message?servicename=conference";
$data = "
<message from='9879870000spalchat@canopus-pc(e.g.senderjid)' to='3698000000spalchat@canopus-pc(e.g.receiverjid)'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<invite from='yorkvillecommunityschoolspalchat@conference.canopus-pc(e.g.groupjid)'/>
</x>
</message>
";
$username = "xxxx";
$password = "xxxxx";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PORT, "9090");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml',
'Authorization: Basic ' . base64_encode("$username:$password")));
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo $code;
$res = curl_exec($ch);
//echo "code " . $code;
echo $res;
print_r($res);
curl_close($ch);
我为此做过R&amp; D然后我发现它是由muc服务插件完成的。