This is the script: I got it from the internet somewhere and wanted to use it on the school server that I manage, but I just needed to create a nice looking front-end which I did in deamweaver...I just linked a button from my dreamweaver to the PHP file that has this function in it... ALL I WANT IT TO DO IS JUST RUN IT FUNCTION...when it people click on the button and it calls this PHP file what you see below is excatly what I get in the browser....
host=$host; } // get IP address public function getIp(){ if(!$ip=gethostbyname($this->host)){ throw new Exception('Error resolving host IP address.'); } return $ip; } // get list of IP addresses public function getIpList(){ if(!$ips=implode(' - ',gethostbynamel($this->host))){ throw new Exception('Error getting list of IP addresses for the provided hostname.'); } return $ips; } // get host name public function getHost(){ if(!$host=gethostbyaddr($this->getIp())){ throw new Exception('Error resolving host name.'); } return $host; } // get TCP ports of Internet services public function getServicePorts(){ $output='Retrieving services ports...Please wait.
'; foreach($this->services as $service){ if(!$port=getservbyname($service,'tcp')){ $output.='Error retrieving port of service '.$service.'
'; } else{ $output.='Service '.$service. ' runs on TCP port :'. $port.'
'; } } return $output; } // get Services by TCP ports public function getServiceNames(){ $output='Retrieving services names...Please wait.
'; foreach($this->ports as $port){ if(!$service=getservbyport($port,'tcp')){ $output.='Error retrieving service name on port '.$port.'
'; } else{ $output.='TCP Port '.$port. ' is used by service :'. $service.'
'; } } return $output; } } try{ // instantiate 'QueryProcessor' object $queryProc=new QueryProcessor('hotmail.com'); // display host IP address //echo $queryProc->getIp(); // displays 64.4.32.7 // display host name //echo $queryProc->getHost(); // displays 'hotmail.com.br' // display IP list //echo $queryProc->getIpList(); // displays 64.4.32.7 - 64.4.33.7 // display services ports echo $queryProc->getServicePorts(); /* displays the following list Retrieving services ports...Please wait. Service http runs on TCP port :80 Service https runs on TCP port :443 Service ftp runs on TCP port :21 Service telnet runs on TCP port :23 Service imap runs on TCP port :143 Service smtp runs on TCP port :25 Service nicname runs on TCP port :43 Service gopher runs on TCP port :70 Service finger runs on TCP port :79 Service pop3 runs on TCP port :110 Service www runs on TCP port :80 */ // display service names echo $queryProc->getServiceNames(); /* displays the following list Retrieving services names...Please wait. TCP Port 21 is used by service :ftp TCP Port 23 is used by service :telnet TCP Port 25 is used by service :smtp TCP Port 43 is used by service :nicname TCP Port 70 is used by service :gopher TCP Port 79 is used by service :finger TCP Port 80 is used by service :http TCP Port 110 is used by service :pop3 TCP Port 143 is used by service :imap TCP Port 443 is used by service :https */ } catch(Exception $e){ echo $e->getMessage(); exit(); } ?>
But when I run it in eclipse this is what I get and this is what I want to see in the browser...
Retrieving services ports...Please wait.
Service http runs on TCP port :80
Service https runs on TCP port :443
Service ftp runs on TCP port :21
Service telnet runs on TCP port :23
Service imap runs on TCP port :143
Service smtp runs on TCP port :25
Service nicname runs on TCP port :43
Service gopher runs on TCP port :70
Service finger runs on TCP port :79
Service pop3 runs on TCP port :110
Service www runs on TCP port :80
Retrieving services names...Please wait.
TCP Port 21 is used by service :ftp
TCP Port 23 is used by service :telnet
TCP Port 25 is used by service :smtp
TCP Port 43 is used by service :nicname
TCP Port 70 is used by service :gopher
TCP Port 79 is used by service :finger
TCP Port 80 is used by service :http
TCP Port 110 is used by service :pop3
TCP Port 143 is used by service :imap
TCP Port 443 is used by service :https
I HOPE THIS INFO HELPS