note 55675 deleted from function.fsockopen by cmb
| From: | cmb@php.net | Date: | Sun, 07 Jul 2019 07:40:31 +0000 |
| Subject: | note 55675 deleted from function.fsockopen by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211487@lists.php.net to get a copy of this message | ||
Note Submitter: dna at revold-design dot de
----
Something useful for ICQ:
<?php
$icquin = "197829943";
function GetICQ($uin) {
if (!is_numeric($uin)) return FALSE;
$fp = fsockopen('status.icq.com', 80, $errno, $errstr, 8);
if (!$fp) {
return "N/A";
}
else {
$request = "HEAD /online.gif?icq=$uin HTTP/1.0\r\n"
."Host: web.icq.com\r\n"
."Connection: close\r\n\r\n";
fputs($fp, $request);
do {
$response = fgets($fp, 1024);
}
while (!feof($fp) && !stristr($response, 'Location'));
fclose($fp);
if (strstr($response, 'online1')) return 'Online';
if (strstr($response, 'online0')) return 'Offline';
if (strstr($response, 'online2')) return 'N/A';
// N/A means, this User set the Option, his Online
// Status cannot be shown over the Internet
return FALSE;
}
}
echo GetICQ($icquin);
?>