Code to determine whether ICQ is online_PHP tutorial

WBOY
Release: 2016-07-13 17:23:42
Original
760 people have browsed it

//判断ICQ是否在线的代码


function get_status($uin)
{
$fp = fsockopen ("wwp.icq.com", 80, &$errno, &$errstr, 30);
if(!$fp)
{
echo "$errstr ($errno)
";
}
else
{
fputs($fp, "GET /scripts/online.dll?icq=$uin&img=5 HTTP/1.0 ");
$do = yes;
while(!feof($fp))
{
$line = fgets ($fp,128);
$do = ($do == yes)?yes:(eregi("^GIF89", $line))?yes:no;
//echo $line;

if($do == yes)
{
if(ereg("@", $line))
{
return online;
}
elseif(ereg("醱", $line))
{
return offline;
}
elseif(ereg("S", $line))
{
return disabled;
}
}

}
fclose($fp);
}
return unknown!;
}


$uin="72485936"; // sonymusic 的ICQ,呵呵。
echo get_status($uin);
// offline
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/532211.htmlTechArticle//判断ICQ是否在线的代码 function get_status($uin) { $fp = fsockopen ("wwp.icq.com", 80, $errstr, 30); if(!$fp) { echo "$errstr ($errno) "; } else { fputs($fp, "GET /script...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!