DrayChou / xmpphp

Automatically exported from code.google.com/p/xmpphp
0 stars 0 forks source link

Http-bind error #47

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello, i'm trying to run 'webclient_example.php' on my local Openfire
server with HTTP-Binding enabled and old-style script syntax support enabled.
#line 12: $conn = new XMPPHP_BOSH('localhost', 5222, 'someuser',
'somepass', 'xmpphp', 'localhost', $printlog=true,
$loglevel=XMPPHP_Log::LEVEL_VERBOSE);
#line 22: $conn->connect('http://localhost:7070/http-bind', 1, true);

As output I get:
1234814173 [VERBOSE]: Error on stream_select()
1234814173 [WARNING]: Reconnecting (30)...

Fatal error:  Uncaught exception 'Exception' with message 'String could not
be parsed as XML' in C:\xampp\htdocs\XMPPHP\BOSH.php:75
Stack trace:
#0 C:\xampp\htdocs\XMPPHP\BOSH.php(75): SimpleXMLElement->__construct('')
#1 C:\xampp\htdocs\XMPPHP\XMLStream.php(337): XMPPHP_BOSH->connect(30,
false, false)
#2 C:\xampp\htdocs\XMPPHP\XMLStream.php(401): XMPPHP_XMLStream->doReconnect()
#3 C:\xampp\htdocs\XMPPHP\XMLStream.php(471): XMPPHP_XMLStream->__process()
#4 C:\xampp\htdocs\webclient_example.php(24):
XMPPHP_XMLStream->processUntil(Array)
#5 {main}
  thrown in C:\xampp\htdocs\XMPPHP\BOSH.php on line 75

I'm, using latest SVN version of this library. My OS is Windows XP SP3 and
as webserver I'm using Apache2+PHP5(XAMPP distribution).

The same error I've get at remote ejabberd server, but I'm not sure that
that server works correctly.

Original issue reported on code.google.com by ua.bogus on 16 Feb 2009 at 8:08

GoogleCodeExporter commented 9 years ago
got nearly the same error. Looks like "$this->socket" is not set in BOSH.php
"connect" function, but "$this->socket" will be used by XMLStream.php in 
function
__process() later on.

Original comment by heini.he...@gmail.com on 27 Feb 2009 at 10:23

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
$response might be empty or bool(false)

Original comment by gasp...@gmail.com on 2 Mar 2009 at 6:51

GoogleCodeExporter commented 9 years ago
Bogus, Have you checked line 30:
$conn->connect('http://jabber.org:5222/xmpp-httpbind', 1, true);

Original comment by gasp...@gmail.com on 2 Mar 2009 at 7:23

GoogleCodeExporter commented 9 years ago
Yes, but it is line #22 in my post.

Original comment by ua.bogus on 3 Mar 2009 at 4:07

GoogleCodeExporter commented 9 years ago
Anyone have a solution to this problem?

Original comment by ela...@gmail.com on 11 May 2009 at 3:34

GoogleCodeExporter commented 9 years ago
the file bosh.php is out of date

Original comment by kove...@gmail.com on 24 May 2009 at 10:43

GoogleCodeExporter commented 9 years ago
how to configure enabled http-binding in ejabberd? i'm trying xmpp with ejabberd
server on my localhost.. hopefully someone can help me to resolved this fix.. :|

Original comment by aginda...@gmail.com on 14 Feb 2010 at 7:51

GoogleCodeExporter commented 9 years ago
Try to copy 'processUntil' method from XMLStream.php file to BOSH.php.

These solutions work for me.

Original comment by Bud...@gmail.com on 11 Mar 2010 at 9:40

Attachments:

GoogleCodeExporter commented 9 years ago
@Budnix: it works (on ejabberd-2.1.2)! thank you

Original comment by davide.s...@gmail.com on 20 Apr 2010 at 12:35

GoogleCodeExporter commented 9 years ago
I am currently using strophe to connect with the BOSH client, i am looking at a 
way to make a BOSH connection via PHP backend so that i can store the JID, SID 
and RID for the session that can be used across browser pages.

Currently a new connection is initiated whenever the page refreshes, i also 
tried the same with Strophe storing these values in a cookie but the attach 
always fails with Invalid SID.

The current BOSH implementation fails all the time, is there going to support 
for making BOSH connections inside PHP scripts!!

Original comment by sheld...@gmail.com on 16 Sep 2010 at 5:07

GoogleCodeExporter commented 9 years ago
I found a mistake in BOSH.php. It looks like is uncorrect to set cURL encoding 
with headers, because cURL will not decode answer than. I make next 
modifications there
(at line 95):

$header = array('Content-Type: text/xml; charset=utf-8');  // Changed
curl_setopt($ch, CURLOPT_HTTPHEADER, $header );
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');    // Added

after this modification all is ok about this bug:
----
Fatal error:  Uncaught exception 'Exception' with message 'String could not
be parsed as XML' in C:\xampp\htdocs\XMPPHP\BOSH.php:75
-----

Original comment by epsilonc...@gmail.com on 4 Mar 2011 at 11:02

GoogleCodeExporter commented 9 years ago
After changes was done
>>> Comment 9 by Bud...@gmail.com, Mar 11, 2010

my XMPPHP BOSH application became magically work ! Wooow ! :)

Original comment by epsilonc...@gmail.com on 4 Mar 2011 at 11:07

GoogleCodeExporter commented 9 years ago
I have a problem:

Fatal error:  Maximum execution time of 30 seconds exceeded in 
Z:\home\test1.ru\www\XMPPHP\BOSH.php on line 98

Original comment by vasyakhv...@gmail.com on 11 Jan 2012 at 10:07

GoogleCodeExporter commented 9 years ago
The problem appeared after the work done above. I bad speak English, sorry.

Original comment by vasyakhv...@gmail.com on 11 Jan 2012 at 10:09

GoogleCodeExporter commented 9 years ago
Can you (epsilonc...@gmail.com) show your code with follow two lines:
$conn = new XMPPHP_BOSH('localhost', 5222, 'someuser',
'somepass', 'xmpphp', 'localhost', $printlog=true,
$loglevel=XMPPHP_Log::LEVEL_VERBOSE);
$conn->connect('http://localhost:7070/http-bind' 1, true);
when used openfire.

Original comment by slf198...@gmail.com on 29 Jan 2012 at 9:16

GoogleCodeExporter commented 9 years ago
hi !!!!!!
what is the solution to this problem? .......

I can't attach with strophe ...... help me please .... it is urgent

strophe generate to a petition each second

Original comment by German.E...@gmail.com on 4 Dec 2012 at 9:34

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Please help to fix my problem,

1396257019 [WARNING]: Reconnecting (30)...

Fatal error:  Uncaught exception 'Exception' with message 'String could not be 
parsed as XML' in C:\xampp1\htdocs\xmpphp\XMPPHP\BOSH.php:75
Stack trace:
#0 C:\xampp1\htdocs\xmpphp\XMPPHP\BOSH.php(75): 
SimpleXMLElement->__construct('')
#1 C:\xampp1\htdocs\xmpphp\XMPPHP\XMLStream.php(337): XMPPHP_BOSH->connect(30, 
false, false)
#2 C:\xampp1\htdocs\xmpphp\XMPPHP\XMLStream.php(401): 
XMPPHP_XMLStream->doReconnect()
#3 C:\xampp1\htdocs\xmpphp\XMPPHP\XMLStream.php(471): 
XMPPHP_XMLStream->__process()
#4 C:\xampp1\htdocs\xmpphp\webclient_example.php(24): 
XMPPHP_XMLStream->processUntil(Array)
#5 {main}
  thrown in C:\xampp1\htdocs\xmpphp\XMPPHP\BOSH.php on line 75

Original comment by rithy...@gmail.com on 31 Mar 2014 at 9:15