note 55675 modified in function.fsockopen by mgf

From: Date: Fri, 29 Aug 2008 08:31:38 +0000
Subject: note 55675 modified in function.fsockopen by mgf
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-143971@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); ?> --was-- 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); ?> http://php.net/manual/en/function.fsockopen.php

« previous php.notes (#143971) next »