Re: [PHP-PEAR] libwww for PHP
[email protected] ((Stig Sæther Bakken)) 13 Mar 2001 23:31:08 +0100
| Newsgroups | php.pear |
|---|---|
| Message-ID | <[email protected]> |
[Mike <[email protected]>] > Ok so I've started. But now pear gives me UAEs in PHP (latest version installed from newest PHP Triad (beta) (also occurs on older versions) under WinNT 4 service pack 6. > > Here's the code: > > <?php > require_once 'PEAR.php'; > class Net_HTTP extends PEAR { > function connect($host,$port=80) { > include_once('Socket.php'); > $this->socket = new Net_Socket(); > if (PEAR::isError($this->socket)) { > return new PEAR_Error('unable to create a socket object'); > } > if (PEAR::isError($this->socket->connect($this->host, $this->port))) { > return new PEAR_Error('unable to open socket'); > } > return true; > } > } > $cla=new Net_HTTP; > $cla->connect("google.com"); > ?> > > Suggestions for fixes? Hi, You should return $this->raiseError(...) instead of new PEAR_Error(...). That will allow people to set up defaults for how errors should be handled. It would be nice if you could define error codes too, that will make it easier for non-english users to define localized error messages (error code is the second arg to the PEAR_Error constructor/raiseError). - Stig -- Stig Sæther Bakken <[email protected]> Fast Search & Transfer ASA, Trondheim, Norway