DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

PHP - Finger PHP Simple Client

05.14.2006
| 4063 views |
  • submit to reddit
        // Finger Download Information

<?php
	// Client di Finger

	$fp = fsockopen('kernel.org', 79); // Si collega al seguente server nella porta 79
	
	fputs($fp, '@kernel.org\n'); // Manda una richiesta
	
	echo '<table border=\'0\' cellspacing=\'1\' cellpadding=\'1\' bgcolor=\'black\'>';
	
	while( !feof($fp) )
	{	
		$text = fgets($fp, 128); // Ritorna una risposta

		if(trim($text) != '')
		{
			echo '<tr bgcolor=\'white\'>';
			echo '<td>';
			echo '<font face=\'Arial\' size=\'-2\'>' . trim($text) . '</font>';
			echo '</td>';
			echo '</tr>';
		}
	}
	
	echo '</table>';
	
	fclose($fp);
?>