• Gtalk PHP API 简单例子(基于XMPP)


    简介:这是Gtalk PHP API 简单例子(基于XMPP)的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。

    class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=341446' scrolling='no'>

    1.下载库文件

    传送门:http://code.google.com/p/xmpphp/
    或者使用svn co出来: svn://netflint.net/xmpphp

    简单说明:
    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 of seconds), waiting on events or map them, etc.

    2.使用方法

    解压。其中./XMPPHP为所需文件。其它为例子

    3.示例代码

    <?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!哈哈,就是SB
            $conn->disconnect();
        } catch(XMPPHP_Exception $e) {
            die($e->getMessage());  //异常
        }
    ?>
    

    4.返回消息

    其中,*是用来对个人信息替换的。

    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
     » 转载保留版权:叽叽歪歪 » 《Gtalk PHP API 简单例子(基于XMPP)》
     » 本文链接地址:http://www.jijiwaiwai.info/2011/07/25/gtalk_php_api_xmpp_example/
     » 如果喜欢可以:点此订阅本站

    爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具

    http://biancheng.dnbcw.info/php/341446.html pageNo:6
  • 相关阅读:
    javascript:void(0)是什么意思 天高地厚
    C#开发 WinForm中窗体显示和窗体传值相关知识
    c#在WinForm中重写ProgressBar控件(带%的显示)
    flash在C#中的应用
    c# winform 关于DataGridView的一些操作
    winform中输入数据的验证
    RadioButton和CheckBox
    Manifest文件的配置
    简单程序用于熟悉Activity生命周期
    Activity的生命周期
  • 原文地址:https://www.cnblogs.com/ooooo/p/2243927.html
Copyright © 2020-2023  润新知