How to View Server Status Outside cPanel

From ReduxWiki

Jump to: navigation, search

<?php
//
//Code for server status page outside of WHM.
//Copy green-status.gif, yellow-status.gif and red-status.gif from WHM to this script's directory.
//Change the user, pass and url. That's it.
//


$user = 'username';
$pass = 'password';
$url = 'www.mydomain.com';//do not include 'http://'

$page = @file_get_contents("https://$user:$pass@$url:2087/scripts/servup");

//$int = preg_match("/<table border=2>.*<\/table>/is",$page, $match);
$int = preg_match("/<center>\s+?<table>.*?<\/table><\/center>/is",$page, $match);
echo "<html><head></head><body>";
if($int) {
  echo str_replace('src=/','src=',$match[0]);
}
else {
  echo 'Unable to access server status. Please try again later.';
}
echo "</body></html>";
?>


Image:Tip.png Back to How To Documents
Personal tools