php - port check Error? -
hey got port checker work dynamic image bad error occurs if server offline help?
here says: image small: http://3nerds1site.com/test/finalimage.php?ip=blacknscape.no-ip.biz&port=80
this how should works when it's online?
but anyways heres code not believe code problem maybe webhost hostgator?
<?php $ip = $_get["ip"]; $port = $_get["port"]; $online = "online"; $offline = "offline"; $status = fsockopen($ip, $port) ? $online : $offline; // create blank image , add text $im = imagecreatetruecolor(215, 86); $text_color = imagecolorallocate($im, 233, 14, 91); // sets background light blue $lightblue = imagecolorallocate($im, 95, 172, 230); imagefill($im, 0, 0, $lightblue); //server information imagestring($im, 7, 5, 5, '3nerds1site.com', $text_color); imagestring($im, 2, 40, 30, $ip, $text_color); imagestring($im, 2, 40, 40, $port, $text_color); imagestring($im, 2, 40, 70, $status, $text_color); // set content type header - in case image/jpeg header('content-type: image/png'); // output image imagepng($im); // free memory imagedestroy($im); ?>
- post code here, not on pastebin.
change:
$status = (fsockopen($ip, $port));
to:
$status = (@fsockopen($ip, $port));
the
@
suppresses error messages when you're doing ridiculous this.alternatively, turn off error reporting
error_reporting(0);
.
Comments
Post a Comment