Introduction: This is a detailed page of Gtalk php api (based on XMPP). It introduces PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 341446 'rolling = 'no'>
1. Download The Library File
Transport: http://code.google.com/p/xmpphp/
Or use svn co: SVN: // netflint.net/xmpphp
Simple Description:
Xmpphp is the successor to class. jabber. php that I 've been promising
For years. Taking advantage of PhP5, I believe it to be an elegant
Solution with a direct approach.
Some of the features include:
- Connect to any XMPP 1.0 server (Google Talk, LJ talk, jabber.org, etc)
- Supports TLS Encryption
- Several XML Processing Approaches and supported styles (Process
Indefinitely, processuntil an event, processtime for a number
Seconds), waiting on events or map them, etc.
2. Usage
Decompress the package. ./Xmpphp is the required file. Other examples
3. Example Code
<? PHP require ('xmpphp/XMPP. PHP '); $ conn = new xmpphp_xmpp ('talk .google.com', 5222, 'user @ gmail.com ', 'passwd', 'xmpphp', 'gmail. com ', $ printlog = true, $ loglevel = xmpphp_log: level_info); try {$ Conn-> connect (); $ Conn-> processuntil ('session _ start '); $ Conn-> presence (); $ Conn-> message ('SB @ gmail.com ', 'Hi! This is a test message for php api of Gtalk ~ '); // Sb is short for somebody, to whom you want to send, // a joke! Haha, that is, Sb $ Conn-> disconnect ();} catch (xmpphp_exception $ e) {die ($ e-> getmessage (); // exception}?>
4. Return message
* Is used to replace personal information.
1228 ***** [info]: connecting to TCP: // talk.google.com: 5222 1228 ***** [info]: Starting TLS encryption 1228 ***** [info]: attempting auth... 1228 *** [info]: AUTH success! 1228 *** [info]: bound to user@gmail.com/xmpphp *** 1228 *** [info]: session started OK
» Reprinted copyright: babbling» Gtalk php api simple example (based on XMPP)» This article link address: http://www.jijiwaiwai.info/2011/07/25/gtalk_php_api_xmpp_example/» if you like can: Click here to subscribe to this site
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/341446.html pageno: 6.