有时候我们会用到检测QQ是否在线。
昨天我需要这个功能,就在网上找了一下,基本没有用。很多都是几年前发的代码。
就自己写了一个类,现在分享给大家。
相信大家都知道腾讯有一个QQ在线状态,临时会话的那个服务。
在线就显示在线的图标,否则就显示离线的图标。
我就是根据判断这个写的代码。
<?php /*@ *@ (C) 201e - 醉忆花颜 429590191@qq.com *@ *@ Time:2013-5-2 *@ *@ Name:qqwp.php */ //header("Content-type:text/html; Charset=UTF-8"); function qq_status(){ if (empty($qq))$qq = 429590191; $url = 'http://wpa.qq.com/pa?p=2:'.$qq.':52'; $Headers = get_headers($url, 1); if ($Headers['Location']=='http://pub.idqqimg.com/qconn/wpa/button/button_121.gif'){ $Status = 1; //QQ在线 }elseif ($Headers['Location']=='http://pub.idqqimg.com/qconn/wpa/button/button_120.gif'){ $Status = 2; //QQ离线 }else { $Status = 0; //未知 } Return $Status; } //测试数据 $qqwp = qq_status('429590191'); //测试QQ是否在线,返回1=在线,返回2=离线,返回0=错误 if ($qqwp==1){ echo 'QQ在线'; }elseif ($qqwp==2){ echo 'QQ离线'; }else { echo '出错了'; } ?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Notepad++7.3.1
Easy-to-use and free code editor

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver CS6
Visual web development tools