【发布时间】:2010-07-28 11:25:05
【问题描述】:
我正在使用 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('someid@somewere.com', '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 或类似的东西...请帮助!
【问题讨论】:
-
你试过了吗? #使用 XMPPHP_Log::LEVEL_VERBOSE 为错误报告获取更多日志 #如果这不起作用,您是否在运行 64 位 PHP 和
-
我已经做到了,我使用的是 PHP 5.3.1 版然后也是同样的问题
-
当你做
XMPPHP_Log::LEVEL_VERBOSE时你会得到什么?上面的输出似乎使用了LEVEL_INFO。 -
1280325838 [INFO]:连接到 tcp://talk.google.com:5222 1280325868 [错误]:无法连接。 FailCould not connect before timeout.
-
尝试增加超时时间?