Web Development Network  |  Sites:    Capital Tutorials    Internet Marketing Books    Arcade Games
Depiction- Webmaster Resources
Stock Image

Contributors: SSD VPS in Europe  |  SEO Las Vegas |  EsqRank |  Colorado Springs SEO

Dental SEO Marketing  |  Best Las Vegas SEO Company  |  Park Shore Condos

Misc Links: Submit Tutorials (Earn $$) l Advertising l Privacy Policy | Site Map

Tutorials > PHP > Site Status


Track all server ports to see if they are working properly.

This code snippet, which web hosts may find very useful, can easily track all server ports and display whether they are working properly.


function lookup_ports($hport,$who)
$fp = fsockopen($who, $hport,$errno,$errstr, 4);
if (!$fp){
$data = "<font color=red>".Failed."</font>";
} else {
$data = "<font color=green>".OK."</font>";
return $data;
$domain = ($domain) ? strip_tags($domain) : str_replace("www.","",$HTTP_SERVER_VARS["HTTP_HOST"]) ;
echo "<li><b>".DOMAIN.":</b> $domain</li>";

echo "<li><b>HTTP:</b> <i>".PORT." 80 = <b>".lookup_ports("80",$domain)."</b></i></li>";

echo "<li><b>HTTPS:</b> <i>".PORT." 443 = <b>".lookup_ports("443",$domain)."</b></i></li>";

echo "<li><b>FTP:</b> <i>".PORT." 21 = <b>".lookup_ports("21",$domain)."</b></i></li>";

echo "<li><b>SSH:</b> <i>".PORT." 22 = <b>".lookup_ports("22",$domain)."</b></i></li>";

echo "<li><b>SMTP:</b> <i>".PORT." 25 = <b>".lookup_ports("25",$domain)."</b></i></li>";

echo "<li><b>POP:</b> <i>".PORT." 110 = <b>".lookup_ports("110",$domain)."</b></i></li>";

echo "<li><b>MySQL:</b> <i>".PORT." 3306 = <b>".lookup_ports("3306",$domain)."</b></i></li>";

This script pulls the domain name that it is currently on and uses that in the check, there is no need to declare a domain name unless you would prefer it that way.


$domain = ($domain) ? strip_tags($domain) : str_replace("www.","",$HTTP_SERVER_VARS["HTTP_HOST"]) ;


$domain = 'yourdomain.com';

In Action:

Tutorial Submitted by: Solan



Tutorial Start Photoshop Tutorials
Tutorial Man Wallpaper Stock  More