Home > php教程 > php手册 > body text

朋友网关于QQ相关的PHP代码(研究QQ的绝佳资料)

WBOY
Release: 2016-06-06 20:12:27
Original
781 people have browsed it

这篇文章主要介绍了朋友网关于QQ相关的PHP代码(研究QQ的绝佳资料),本文直接给出实现代码,需要的朋友可以参考下

复制代码 代码如下:


/***************************************

****************************************/
error_reporting(E_ALL ^ E_NOTICE);

require_once( 'http.inc.php' );
require_once( 'class.Chinese.php');


//成功2xx
    define( 'QQ_RETURN_SUCCESS',    200 );
    define( 'QQ_LOGIN_SUCCESS',    201 );
    define( 'QQ_LIST_NONE',        202 );
    define( 'QQ_ADDTOLIST_SUCCESS',    203 );
    define( 'QQ_REPLYADD_SUCCESS',    204 );
    define( 'QQ_GETMSG_NONE',    205 );

//警告3xx
    define( 'QQ_ADDTOLIST_NEEDAUTH',300 );
    define( 'QQ_ADDTOLIST_REFUSE',    301 );
    define( 'QQ_ADDTOLIST_UNKNOWN',    302 );

//失败4xx
    define( 'QQ_RETURN_FAILED',    400 );
    define( 'QQ_LIST_ERROR',    401 );
    define( 'QQ_GETMSG_ERROR',    402 );

//在线状态
    define( 'QQ_STATUS_ONLINE',    10);
    define( 'QQ_STATUS_OFFLINE',    20);
    define( 'QQ_STATUS_BUSY',    30);

//血型
    $QQ_DATA_BT = array
        (
=> '',
=> 'A型',
=> 'B型',
=> 'O型',
=> 'AB型',
=> '其他'
        );

//星座
    $QQ_DATA_CO = array
        (
=> '',
=> '水瓶座',
=> '双鱼座',
=> '牡羊座',
=> '金牛座',
=> '双子座',
=> '巨蟹座',
=> '狮子座',
=> '处女座',
=> '天秤座',
=> '天蝎座',
=> '射手座',
=> '摩羯座'
        );

//生肖
    $QQ_DATA_SH = array
        (
=> '',
=> '鼠',
=> '牛',
=> '虎',
=> '兔',
=> '龙',
=> '蛇',
=> '马',
=> '羊',
=> '猴',
=> '鸡',
=> '狗',
=> '猪'
        );

//性别
    $QQ_DATA_SX = array
        (
=> '男',
=> '女'
        );

class QQClient
{
    var $uin;
    var $pwd;

    var $server    =    'kconn.tencent.com';
    //备用:219.133.51.11
    var $port    =    21001;
    //备用:8000
    var $httpclient;
    var $chs    =    NULL;

    function QQClient($uin,$pwd)
    {
        $this->uin = $uin;
        $this->pwd = $pwd;
    }

    function encode($str)
    /*
        说明:把KEY1=VAL1&KEY2=VAL2格式变为数组
    */
    {
        $arr = explode('&' , $str);
        $return = array();
        foreach($arr as $k=>$v)
        {
            list($key,$val) = explode('=',$v);
            $return[$key] = $val;
            $this->chs = NULL;
        }
        return $return;
    }

    function utf8_to_gb2312($str)
    {
        $this->chs = new Chinese("UTF8","GB2312", $str );
        return $this->chs->ConvertIT();
    }

    function gb2312_to_utf8($str)
    {
        $this->chs = new Chinese("GB2312","UTF8", $str );
        return $this->chs->ConvertIT();
    }

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template