note 55675 added to function.fsockopen

From: Date: Wed, 10 Aug 2005 12:04:28 +0000
Subject: note 55675 added to function.fsockopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-93365@lists.php.net to get a copy of this message
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); ?> ---- Manual Page -- http://www.php.net/manual/en/function.fsockopen.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55675 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55675&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55675&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55675&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55675&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55675&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55675&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55675&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93365) next »