Eiolon Posted February 28, 2007 Share Posted February 28, 2007 I am using a server status script and it works fine but when I put it on a server that is behind a proxy I can't get it to work. Can anyone help me configure it so it gets through the proxy? Thanks! <?php //Page Variables $online='<td style="background-color:#00FF00; padding:5px;">Online</td>'; $offline='<td style="background-color:#FF0000; padding:5px;">Offline</td>'; //Functions function servercheck($server,$port){ //Check that the port value is not empty if(empty($port)){ $port=80; } //Check that the server value is not empty if(empty($server)){ $server='localhost'; } //Connection global $proxy, $proxyport; $fp=@fsockopen($server, $port, $errno, $errstr, 1); //Check if connection is present if($fp){ //Return Alive return 1; } else{ //Return Dead return 0; } //Close Connection fclose($fp); } //Ports and Services to check $services=array( 'HTTP' => array('domainhere.com' => 80), 'SMTP' => array('domainhere.com' => 25), ); ?> <table> <?php //Check All Services foreach($services as $name => $server){ ?> <tr> <td><?php echo $name; ?></td> <?php foreach($server as $host => $port){ if(servercheck($host,$port)){ echo $online; }else{ echo $offline; } } ?> </tr> <?php } ?> </table> Quote Link to comment Share on other sites More sharing options...
Eiolon Posted February 28, 2007 Author Share Posted February 28, 2007 It looks like we can't edit our own posts so I am reposting the code: <?php //Page Variables $online='<td style="background-color:#00FF00; padding:5px;">Online</td>'; $offline='<td style="background-color:#FF0000; padding:5px;">Offline</td>'; //Functions function servercheck($server,$port){ //Check that the port value is not empty if(empty($port)){ $port=80; } //Check that the server value is not empty if(empty($server)){ $server='localhost'; } //Connection $fp=@fsockopen($server, $port, $errno, $errstr, 1); //Check if connection is present if($fp){ //Return Alive return 1; } else{ //Return Dead return 0; } //Close Connection fclose($fp); } //Ports and Services to check $services=array( 'HTTP' => array('domainhere.com' => 80), 'SMTP' => array('domainhere.com' => 25), ); ?> <table> <?php //Check All Services foreach($services as $name => $server){ ?> <tr> <td><?php echo $name; ?></td> <?php foreach($server as $host => $port){ if(servercheck($host,$port)){ echo $online; }else{ echo $offline; } } ?> </tr> <?php } ?> </table> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.