<?
function get_status($uin)
{
$fp = fsockopen ("wwp.icq.com", 80, &$errno, &$errstr, 30);
if(!$fp)
{
echo "$errstr ($errno)<br>\n";
}
else
{
fputs($fp, "get /scripts/online.dll?icq=$uin&img=5 http/1.0\n\n");
$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
// http/1.0 200 ok content-type: image/gif gif89a(幵觮r瑴螗#%醱` ?0? 靦wb缒unknown
// online
// http/1.0 200 ok content-type: image/gif gif89a(幵觮r 瑴螗#%?@ ?0?u靦wb鐒unknown
?>