cvs: pear /Net_Finger Finger.php package.xml
| From: | Sebastian Nohn | Date: | Thu, 04 Oct 2001 17:41:23 +0000 |
| Subject: | cvs: pear /Net_Finger Finger.php package.xml | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-924@lists.php.net to get a copy of this message | ||
nohn Thu Oct 4 13:41:23 2001 EDT
Added files:
/pear/Net_Finger Finger.php package.xml
Log:
initial release
Index: pear/Net_Finger/Finger.php
+++ pear/Net_Finger/Finger.php
<?php
//
// +----------------------------------------------------------------------+
// | PHP version 4.0 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2001 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt.
|
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Sebastian Nohn <sebastian@nohn.net> |
// +----------------------------------------------------------------------+
//
// $Id: Finger.php,v 1.1 2001/10/04 17:41:23 nohn Exp $
//
require_once 'PEAR.php';
require_once 'Net/Socket.php';
/**
* PEAR's Net_Finger:: interface.
*
* Provides functions useful for Finger-Queries.
*
* @version $Revision: 1.1 $
* @author Sebastian Nohn <sebastian@nohn.net>
* @package Net
*/
class Net_Finger
{
/**
* Implements Net_Finger::query() function using PEAR's socket functions
*
* @param string $server The finger-server to query
* @param string $query The finger database object to lookup
* @return mixed The data returned from the finger-server as string
* or a PEAR_Error ( see Net_Socket for error codes)
*/
function query($server, $query)
{
$socket = new Net_Socket;
if( PEAR::isError( $sockerror = $socket->connect($server, 79))) {
$data = new PEAR_Error( "Error connecting to $server ( Net_Socket says: ".
$sockerror->getMessage().")",
$sockerror->getCode());
} else {
$query .= "\n";
$socket->write($query);
$data = $socket->read(16384);
$socket->disconnect();
}
return $data;
}
}
?>
Index: pear/Net_Finger/package.xml
+++ pear/Net_Finger/package.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- do not use the "Type" attribute here, that one is only for
generated package.xml files -->
<package>
<name>Net_Finger</name>
<summary>The PEAR::Net_Finger class provides a tool for querying Finger
Servers</summary>
<maintainer>
<user>SN</user>
<name>Sebastian Nohn</name>
<email>sebastian@nohn.net</email>
</maintainer>
<release>
<version>0.1</version>
<date>2001-09-29</date>
<notes>
This is the initial independent release of the Net_Finger package.
</notes>
</release>
<filelist>
<dir name="/" baseinstalldir="Net">
<file role="php">Finger.php</file>
</dir>
</filelist>
</package>