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 enter image description here

this how should works when it's online? enter image description here

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); ?> 

  1. post code here, not on pastebin.
  2. change:

    $status = (fsockopen($ip, $port)); 

    to:

    $status = (@fsockopen($ip, $port)); 

    the @ suppresses error messages when you're doing ridiculous this.

  3. alternatively, turn off error reporting error_reporting(0);.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -