Judging whether the OICQ is online with PHP

zhaozj2021-02-08  256

Source: Keniv

Function Get_Status ($ uin)

{

$ fp = @fsockopen ("InfoCenter.tencent.com", 80, & $ Errno, & $ Errstr, 30);

IF (! $ fp)

{

Return 'error';

}

Else

{

FPUTS ($ FP, "GET / $ UIN / L / 00/0 / HTTP / 1.0 / N / N");

$ do = 'yes';

While (! Feof ($ fp))

{

$ line = fgets ($ fp, 128);

$ do = ($ do == 'yes')? 'Yes': (EREGI ("^ Gif89", $ LINE))? 'Yes': 'NO';

IF ($ do == 'yes')

{

IF (EREG ("Online", $ LINE)

{

Return 'online';

}

Elseif (EREG ("OFFLINE", $ LINE)

{

Return 'is not online';

}

}

}

Fclose ($ fp);

}

Return 'unknown';

}

$ uin = '1697313'; // I am my own

Echo get_status ($ uin);

?>

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

New Post(0)