Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to use PEAR? 1

Status
Not open for further replies.

RobBroekhuis

Technical User
Joined
Oct 15, 2001
Messages
1,971
Location
US
Getting my feet wet, trying to use PEAR (specifically, the Net/Whois module). But things aren't working, and I don't understand things well enough from the pear.php.net documentation - perhaps one of you can set me straight.
I'm on a hosted web server, which has some pear features installed ("which pear" finds a copy in /usr/local/bin/pear, and the include path leads to a directory with PEAR.php). I can't seem to get the pear package manager to do anything useful (whatever I try, it just tells me "No such file or directory"). So I downloaded the Whois.php directly to a local directory, and did a require_once("Whois.php)" in my script. The script runs, and gets past the require("PEAR.php") in the Whois.php include, but fails shortly thereafter, on the line

$whoisServer = $this->_chooseServer($domain);M

with the error:
Fatal error: Call to a member function on a non-object in Whois.php

What am I missing? Could the server version of PEAR.php be too old? (File date is Oct 30, 2002)
Thanks for your help


Rob
[flowerface]
 
You are trying to call a method on a non exisiting object. When you use a class like that you need to create an instance of the object before calling any methods on it.
Code:
# create an instance of the object by calling the constructor
$whois = new Net_Whois;
# now you can execute methods
 
Thanks much! After running into another error, and discovering I also had to install the Net_Socket module, I got things running. I guess I'll have to read up on objects and classes in PHP - something I've avoided so far...


Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top