XMPP.php 类不工作
我正在使用 XMPP.php(即 XMPP 类)在 GTalk 中创建聊天应用程序。我已经输入了正确的 Gtalk 用户名和密码,但它不起作用。 我使用的代码(从 GitHub.com 获取)
<?php
include 'XMPP.php';
#Use XMPPHP_Log::LEVEL_VERBOSE to get more logging for error reports
#If this doesn't work, are you running 64-bit PHP with < 5.2.6?
$conn = new XMPPHP_XMPP('talk.google.com', 5222, 'username', 'pass', 'xmpphp', 'gmail.com', $printlog=false, $loglevel=XMPPHP_Log::LEVEL_INFO);
try {
echo "Welcome 2 ";
$conn->connect(100, false, true);
$conn->processUntil('session_start');
$conn->presence();
$conn->message('[email protected]', 'This is a test message!');
$conn->disconnect();
} catch(XMPPHP_Exception $e) {
echo "Fail";
die($e->getMessage());
}
?>
和我收到的错误(异常)是
Welcome 2 Fail Could not connect before timeout.
我正在使用基于 unix 的网络服务器,是否需要任何软件来运行 Chatserver 或类似的东西...请帮忙!
I am using XMPP.php (i.e XMPP Class) to create a chat application in GTalk. i have put the correct username and password of Gtalk but it is not working.
the code i used (got it from GitHub.com)
<?php
include 'XMPP.php';
#Use XMPPHP_Log::LEVEL_VERBOSE to get more logging for error reports
#If this doesn't work, are you running 64-bit PHP with < 5.2.6?
$conn = new XMPPHP_XMPP('talk.google.com', 5222, 'username', 'pass', 'xmpphp', 'gmail.com', $printlog=false, $loglevel=XMPPHP_Log::LEVEL_INFO);
try {
echo "Welcome 2 ";
$conn->connect(100, false, true);
$conn->processUntil('session_start');
$conn->presence();
$conn->message('[email protected]', 'This is a test message!');
$conn->disconnect();
} catch(XMPPHP_Exception $e) {
echo "Fail";
die($e->getMessage());
}
?>
and the error (exception) i am getting is
Welcome 2 Fail Could not connect before timeout.
i am using unix based webserver, is there any software needed to run Chatserver or something like that... please help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说,增加超时值后问题就会消失。或者,尝试 Jaxl 库 http://github.com/abhinavsingh/JAXL 如果您仍然面临同样的问题......
Generally the problem should disappear after increasing timeout value. Alternately, try out Jaxl library http://github.com/abhinavsingh/JAXL in case you are still facing the same problem ....