PX : code

ICQ status by jan
Rating: 5.00
Download this code


<?php
function getICQstatus($uin) {
    if (!
is_numeric($uin)) 
        return 
false;

    
$fp = @fsockopen('web.icq.com'80$errno$errstr8);
    if (!
$fp
        return 
false;

    
$request "HEAD /whitepages/online?icq=$uin&img=5 HTTP/1.0\r\n"
              
."Host: wwp.icq.com\r\n"
              
."Connection: close\r\n";
    
fputs($fp$request);

    do {
       
$result fgets($fp1024);
    }
    while (!
feof($fp) && !stristr($result'Location'));

    
fclose($fp);

    if (
strstr($result'4367')) 
        return 
'online';

    if (
strstr($result'4349'))
        return 
'offline';

    if (
strstr($result'4386')) 
        return 
'disabled';
    
    return 
false;
}

echo 
getICQstatus(12345678);
?>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.