Gtalk php api simple example (based on XMPP)

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.