cvs: pear /Net_Whois Whois.php

From: Date: Mon, 27 Aug 2001 01:18:06 +0000
Subject: cvs: pear /Net_Whois Whois.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-668@lists.php.net to get a copy of this message
alexmerz Sun Aug 26 21:18:06 2001 EDT Modified files: /pear/Net_Whois Whois.php Log: use PEAR_Error Index: pear/Net_Whois/Whois.php diff -u pear/Net_Whois/Whois.php:1.4 pear/Net_Whois/Whois.php:1.5 --- pear/Net_Whois/Whois.php:1.4 Fri Aug 24 17:02:49 2001 +++ pear/Net_Whois/Whois.php Sun Aug 26 21:18:06 2001 @@ -16,9 +16,10 @@ // | Authors: Sebastian Nohn <sebastian@nohn.net> | // +----------------------------------------------------------------------+ // -// $Id: Whois.php,v 1.4 2001/08/24 21:02:49 mj Exp $ +// $Id: Whois.php,v 1.5 2001/08/27 01:18:06 alexmerz Exp $ // +require_once 'PEAR.php'; require_once 'Net/Socket.php'; /** @@ -26,7 +27,7 @@ * * Provides functions useful for Whois-Queries. * - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * @author Sebastian Nohn <sebastian@nohn.net> * @package Net */ @@ -38,14 +39,15 @@ * * @param string $server The whois-server to query * @param string $query The whois database object to lookup - * @return string The data returned from the whois-server + * @return mixed The data returned from the whois-server as string + * or a PEAR_Error ( see Net_Socket for error codes) */ function query($server, $query) { $socket = new Net_Socket; - $fp = $socket->connect($server, 43); - if (!$fp) { - $data = "Error connecting to $server"; + if( PEAR::isError( $sockerror = $socket->connect($server, 43))) { + $data = new PEAR_Error( "Error connecting to $server ( Net_Socket says: ". + $sockerror->getMessage().")", $sockerror->getCode()); } else { $query .= "\n"; $socket->write($query);

« previous php.pear.cvs (#668) next »