dsavz66262 2012-10-25 09:06
浏览 52
已采纳

XMPPHP无法连接到Prosody [重复]

Possible Duplicate:
jaxl can’t connect to Prosody

I can authenticate fine with other clients including SleekXMPP and Strophe.

Using Prosody 0.8.2 on Ubuntu 12.04 with the latest pearhub/cwXMPPHP (0.0.2).

The code:

require 'XMPPHP/BOSH.php';

$conn = new XMPPHP_BOSH('localhost', 5280, 'yang@localhost', 'asdf', 'xmpphp', 'localhost', $printlog=true, $loglevel=XMPPHP_Log::LEVEL_VERBOSE);
$conn->autoSubscribe();

$conn->connect('http://localhost/chat/candy/example/http-bind/');

from client:

<body xmlns="http://jabber.org/protocol/httpbind" xmlns:xmpp="urn:xmpp:xbosh" content="text/xml; charset=utf-8" rid="3001" lang="en" hold="1" to="localhost" route="xmpp:localhost:5280" secure="true" xmpp:version="1.6" wait="1" ack="1" xmpp="urn:xmpp:xbosh"/>

from server:

<body authid='ceb81a64-8fd4-485e-8b55-d848d1cef249' xmpp:version='1.0' xmlns:stream='http://etherx.jabber.org/streams' xmlns:xmpp='urn:xmpp:xbosh' inactivity='60' wait='1' polling='5' secure='true' hold='1' from='localhost' ver='1.6' sid='ceb81a64-8fd4-485e-8b55-d848d1cef249' requests='2' xmlns='http://jabber.org/protocol/httpbind'>

Output:

$ php login.php
127.0.0.1 - - [25/Oct/2012:02:02:38 -0700] "POST /chat/candy/example/http-bind/ HTTP/1.1" 200 477 "-" "-"
PHP Warning:  SimpleXMLElement::__construct(): Entity: line 1: parser error : Start tag expected, '<' not found in /usr/share/php/XMPPHP/BOSH.php on line 75
PHP Warning:  SimpleXMLElement::__construct():  in /usr/share/php/XMPPHP/BOSH.php on line 75
PHP Warning:  SimpleXMLElement::__construct(): ^ in /usr/share/php/XMPPHP/BOSH.php on line 75
PHP Fatal error:  Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /usr/share/php/XMPPHP/BOSH.php:75
Stack trace:
#0 /usr/share/php/XMPPHP/BOSH.php(75): SimpleXMLElement->__construct('?????????????R?...')
#1 /home/yang/chat/login.php(39): XMPPHP_BOSH->connect('http://localhos...')
#2 {main}
  thrown in /usr/share/php/XMPPHP/BOSH.php on line 75

Prosody server log:

$ Oct 25 02:02:38 socket        debug   server.lua: accepted new client connection from 127.0.0.1:41407 to 5280
Oct 25 02:02:38 mod_bosh        debug   BOSH body open (sid: %s)
Oct 25 02:02:38 bosh869caf76-5a90-4d5f-9a75-6bc1dd54a5f5        debug   BOSH session created for request from 127.0.0.1
Oct 25 02:02:38 mod_bosh        info    New BOSH session, assigned it sid '869caf76-5a90-4d5f-9a75-6bc1dd54a5f5'
Oct 25 02:02:38 httpserver      debug   Sending response to c5fa80
Oct 25 02:02:38 httpserver      debug   Destroying request c5fa80
Oct 25 02:02:38 httpserver      debug   Request has destroy callback
Oct 25 02:02:38 socket  debug   server.lua: closed client handler and removed socket from list
Oct 25 02:02:38 mod_bosh        debug   Session 869caf76-5a90-4d5f-9a75-6bc1dd54a5f5 has 0 out of 1 requests open
Oct 25 02:02:38 mod_bosh        debug   and there are 0 things in the send_buffer

Any ideas? Thanks in advance for any help.

  • 写回答

1条回答 默认 最新

  • dongzhao4036 2012-10-25 09:38
    关注

    That package on pearhub is very outdated. Please try any of the forks at github, https://github.com/cweiske/xmpphp/network

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化