XMPP.php 类不工作

发布于 2024-09-12 03:38:23 字数 1035 浏览 7 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

短暂陪伴 2024-09-19 03:38:23

一般来说,增加超时值后问题就会消失。或者,尝试 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 ....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文