Friend gateway's PHP Code related to QQ (excellent information on QQ)

Source: Internet
Author: User
This article mainly introduces the PHP Code related to QQ used by friend Gateway (excellent information on QQ). This article provides the implementation code directly. For more information, see

This article mainly introduces the PHP Code related to QQ used by friend Gateway (excellent information on QQ). This article provides the implementation code directly. For more information, see

The Code is as follows:


<?
/***************************************

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

Require_once ('HTTP. inc. php ');
Require_once ('class. Chinese. php ');


// Success 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 );

// Warning 3xx
Define ('qq _ ADDTOLIST_NEEDAUTH ', 300 );
Define ('qq _ ADDTOLIST_REFUSE ', 301 );
Define ('qq _ ADDTOLIST_UNKNOWN ', 302 );

// Failure 4xx
Define ('qq _ RETURN_FAILED ', 400 );
Define ('qq _ LIST_ERROR ', 401 );
Define ('qq _ GETMSG_ERROR ', 402 );

// Online status
Define ('qq _ STATUS_ONLINE ', 10 );
Define ('qq _ status_offline', 20 );
Define ('qq _ STATUS_BUSY ', 30 );

// Blood type
$ QQ_DATA_BT = array
(
=> '',
=> 'A ',
=> 'B ',
=> 'O type ',
=> 'AB type ',
=> 'Others'
);

// Constellation
$ QQ_DATA_CO = array
(
=> '',
=> 'Aquarius ',
=> 'Pisces ',
=> 'Sheepse ',
=> 'Taurus ',
=> 'Gemins ',
=> 'Loan ',
=> 'Leo ',
=> 'Virgo ',
=> 'Libra ',
=> 'Scorpio ',
=> 'Sagittarius ',
=> 'Capricorn'
);

// Chinese zodiac
$ QQ_DATA_SH = array
(
=> '',
=> 'Rat ',
=> 'Niu ',
=> 'Hu ',
=> Rabbit ',
=> 'Long ',
=> 'Snake ',
=> 'Ma ',
=> 'Yang ',
=> 'Monkey ',
=> 'Chicken ',
=> 'Dog ',
=> 'Pig'
);

// Gender
$ QQ_DATA_SX = array
(
=> 'Male ',
=> Female'
);

Class QQClient
{
Var $ uin;
Var $ pwd;

Var $ server = 'kconn .tencent.com ';
// Standby: 219.133.51.11
Var $ port = 21001;
// Backup: 8000
Var $ httpclient;
Var $ chs = NULL;

Function QQClient ($ uin, $ pwd)
{
$ This-> uin = $ uin;
$ This-> pwd = $ pwd;
}

Function encode ($ str)
/*
Note: Convert the KEY1 = VAL1 & KEY2 = VAL2 format to an array.
*/
{
$ 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 ();
}

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.