Hi, I need to make an mx request to a host sto i installed the Net_DNS package. I copy pasted this code from the developers site: <?php // include class file include("Net/DNS.php"); // create object $ndr = new Net_DNS_Resolver(); // query for IP address $answer = $ndr->search("www.cnet.com", "MX"); // print output $answer->answer[0]->display(); echo "<br>"; $answer->answer[1]->display(); ?> Code (markup): I execute it and i get the following two errors: Notice: Trying to get property of non-object in C:\Program Files\Apache Group\Apache2\htdocs\dns\dnsspec.php on line 13 Fatal error: Call to a member function display() on a non-object in C:\Program Files\Apache Group\Apache2\htdocs\dns\dnsspec.php on line 13 What does this mean? How can i fix it and make it work?
you need to initiate the object in order to use it. www.php.net/oop what is $ndr? it should be initiated. $ndr = new ClassName;
Perhaps the pathing is invalid in your include of the DNS.php script. From your .php file (the one with the code you've posted here) is the DNS.php file located in a subfolder named "Net" (case sensitive)?
this is my include path: ;include_path = "C:\PHP5\PEAR" and this is my php instalation dir: C:\PHP5 the package is installed in: C:\PHP5\PEAR\Net and i use php5 The dns.php file is part of the pear package. The package documentation says that it cannot be called statically. I thought that $ndr = new Net_DNS_Resolver(); initiates the object. Net_DNS_Resolver is the name of the object. should it be something like: DNS::Net_DNS_Resolver($ndr); or DNS->Net_DNS_Resolver($ndr); Im kind of confused because php4 and 5 initiate objects difrently and im not very familiar with objects and classes.