Use PHP to take QQ online status

xiaoxiao2021-03-06  19

These two days have no heart, I wrote this little thing to take QQ online status with php. The principle is simple, I will not be said, I can see the code. It is a state of the interactive status. The usage is also simple, the incoming parameter is the QQ number, the function returns 1 indicates that the QQ is online, and the function returns 0 indicates that QQ is not online, and returns less than 0 indicates an error. Note: QQ is required to log in with QQ2004II Beta1 or above to detect it :) I wish you all a Merry Christmas. The attachment code is as follows: | // -------- -------------------------------------------------- ---------- // $ ID $

/ ** * @note license: GNU General Public License (GPL) Version 2 * @vers $ rcsfile $ * @version 1.0 * @Author fishchen * @date 2004/12/24 11:00:00 (Merry Xmas) * @ Brief Get QQ Online Status. * /

/ * {{{function tphp_qq_online ($ uin) * // ** * get qq online status. * * @note need User login QQ with qq2004iibeta1 or last. * @Param Int $ uin qq number. * @retval int $ RET 1: Online, 0: Offline, <0: error. * / Function tphp_qq_online ($ uin) {$ reques = "Get /Pa?p=1:" $ @": 1 http / 1.1 / r / n " $ Reques. = "Host: wpa.qq.com/r/N"; $ Reques. = "User-agent: php_qq_spy / r / n / r / n";

IF (! ($ socket = socket_create (AF_INET, SOCK_STREAM, SOL_TCP))) Return (-1); if (! ((! (Socket_connect ($ socket, "wpa.qq.com", 80))) Return (-1); IF (! ($ socket, $ reques))) Return (-1); if (! ($ respon = socket_read ($ socket, 1024, php_binary_read)) Return (-1); Socket_Close ($ socket) $ Field = EXPLODE ("/ R / N", $ Respon; for ($ I = 0; $ i

?>

转载请注明原文地址:https://www.9cbs.com/read-77156.html

New Post(0)