Wednesday, April 2, 2008

Introducing XMPPHP

Well, I've finally done it. I finally took two evenings and wrote a replacement to Class.Jabber.PHP that I had been promising for eons. It'll work with XMPP 1.0 servers, it does TLS, has persistent connections, is event driven, etc. I'll try to get some more documentation in the coming days, but the examples included give you a pretty good idea. Check it out at svn://netflint.net/xmpphp and http://code.google.com/p/xmpphp.

This is based largely on my experience building SleekXMPP, and I'll certainly be taking some things and applying it there (threadless mode, and simpler handlers).

The only thing missing from Class.Jabber.PHP is Rosters and Registration, which I'll get to in the coming days. Please take a look and provide any feedback you might have. Also feel free to ask for my help in implementing it. I'm off to bed!

24 comments:

Unknown said...

Hi. I tried implementing your code examples. I'm getting:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in xmpp.php on line 53

Daniel Skinner said...

Two minutes ago I was thinking of building an AJAX chat interface for a CMS. Then I thought it would be cool if when I was on Google Talk, clients in the CMS would be able to chat with me in real-time so I could help them out.

Google Talk must support an open service - XMPP - Great! Now to remember everything I forgot about the Sockets API...

No, wait, Fritzy the Great has already thought this one through!

This is an awesome piece of work - keep it up!

Dan said...

Nice work! I look forward to seeing this evolve (more examples, more tests, more delicious goodness).

If you were keen, you could put this in as a PEAR proposal...

Dan said...

See also:
PEAR::Log

Unknown said...

Hi nathan,
thanks for the great stuff you have bought out. it doesnt run in my setup though with some cli php notice and warnings. i used r18. Though i appied the patches listed in issue2, and 6, it still doesnt work. Please bring out a new revision soon

cheers!
ashu

chakri said...

grt8 work !! :)

Dan Phiffer said...

I'm curious, could XMPPHP be used to subscribe to the Twitter public feed? They are using PubSub (XEP-0060) which, from what I gather, is a plugin for XMPP. Is that the same kind of plugin listed on your TODO list in the README file?

Unknown said...

Hi Fritzy,

What I can't seem to fully understand is how you can keep a session open through a Web Application which closes the connection upon PHP execution finishes...

anup Singh said...

Hi, My question is , How to connect to yahoo messenger, using XMPPHP? if any one can help me it would be great.
Thanks in advance.

Unknown said...

your lib is great! Please keep on working on it, especially the MUC support ;-)

vad said...

Hi, nobody knows how to keep the connection up between ajax calls? (same thing paris wants to do, i think)

I tried to serialize the XMPP object, but it doesn't work.

Thank you

Unknown said...

We'd like to implement the Roster and other functionality from code we've developed from xmpp for an automated transport client / bot.

How is best to join the project and help keep things moving?

Thanks

Unknown said...

I've implemented your class and I noticed that it takes a realllly long time to run the example you provide on google code(loop bit, last example)...it works flawlessly but takes like 20 seconds....is that normal?

Unknown said...

Hello !
great work.
I have a problem.
I am in a university and I connect to web by http proxy server. But with proxy server XMPPHP doesnt work.
it gives this error:
Warning: stream_socket_client() [function.stream-socket-client]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/xmpphp/xmlstream.php on line 86

Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to tcp://talk.google.com:5222 (Unknown error) in /var/www/xmpphp/xmlstream.php on line 86
ERROR : Could not connect.
Warning: stream_set_blocking(): supplied argument is not a valid stream resource in /var/www/xmpphp/xmlstream.php on line 91


CAn you please help me out

HBR said...

Hi. I don't know where you have been up to with this class but it really rocks, and I must say, I am impatiently waiting for the Roster support.
The dev of my website is in stand by just because there are no classes out there dealing with xmpp, and I have no idea how to start my own API, I don't have the time neither to learn it from scratch.

So please, don't leave us hanging on ;)

olli said...

Good work! Here are however some suggestions to make usage of XMPPHP easier:

1) Making the function docblocks more verbose. This way the developer could treat the functionality as a set of black boxes instead of having to read and understand the implementation details.

2) Further hiding implementation by making XMLStream's functions protected or private where possible. This way the developer could clearly perceive the intended public interface.

Harish said...

I tried your code... but i didn't get any reactions...no alerts or nothing... can u please help me out... because am so much interested on open source programs. Also am opensource researcher.

I am a representer of Closedlogics community. Please explain me more detail.

You can contact me through : r.harishnarayanan@gmail.com

Thanks in advance

Harishankaran said...

Hi, I am using your library. I need to send a message to all the contacts (whether they are offline or online). The send message function is great, but how do I get the list of all the contacts?. Do you have any function for that?

Laurent J.V. Dubois Solu-Vente.com said...

Thanks for this contribution !

Unknown said...

Hello I was pointed here from the Jabber board. I am trying to have a button on out rep login page that will auto send a message with "one click". We are trying to get it to auto populate the to and message fields and auto send. We would like it not leave an open chat window just autosend one message stating "Need Assistance Station [A] --- where [A] is station number. We are using QueueMetrics and it will populate the [A] variable.

Mr.K said...
This comment has been removed by the author.
Mr.K said...

I am hosting ejabberd on my vps,I am trying to connect to server using custom app with xmpphp library but it says
[INFO]: Connecting to tcp://:5222 [VERBOSE]: Socket is ready; send it.

but the message never reaches other end.

But same php app running on another server works.

I have opened all three ports 5222 5269 & 5280

Help appreciated?

Anonymous said...

These are all provided by a few of the the} biggest names within the iGaming world — allowing you to check some of the the} 카지노사이트 world’s finest actual money games totally at no cost. Casino websites listed on our site may not be not|will not be} out there in your area. Check your local laws to ensure online playing is on the market and authorized the place you live.

Anonymous said...

First, might be} the event stage, where Playtika is not the most effective in the world “, Rapps admits. Europa Casino on-line has loads of deal of} banking options obtainable. You’ll also get an R350 Free Chip to get the celebration started before 1xbet you even deposit cash.