xmpphp测试openfire发布信息
1.先下载xmpphp,,地址:https://code.google.com/p/xmpphp/downloads/list
2.编写php脚本。
<?phprequire('XMPPHP/XMPP.php');$conn = new XMPPHP_XMPP('csdn.shimiso.com', 5222, 'admin@csdn.shimiso.com','niuyufu123', 'xmpphp', 'csdn.shimiso.com', $printlog = true,$loglevel = XMPPHP_Log::LEVEL_INFO);try {$conn->connect(10);$conn->processUntil('session_start');$conn->presence();$conn->message('richard@csdn.shimiso.com', 'Hi! This is a test message for PHP API of Gtalk~');$conn->disconnect();} catch(XMPPHP_Exception $e) {die($e->getMessage()); //异常}?>
成功截图:
可能遇到的问题:1269283038 [INFO]: Connecting to tcp://csdn.shimiso.com:5222
1269283038 [ERROR]: Could not connect.
这时要检查openfire的配置,最重要的是关闭selinux及iptables.
问:一只小狗在沙漠中旅行,结果死了,问他是怎么死的?