Jump to content
  • 0

How to get on/off with PHP SDK


gamelaster

Question

1 answer to this question

Recommended Posts

  • 0

Title sais with PHP. Well if you want to know if a server is on/off you should try this:

header(”Content-type: image/jpg”); 
  
$server = “207.154.202.100″; 
$port = “5278″; 
$images = “imagenes/”; 
@$state = fsockopen($server, $port, $errno, $errstr, 10); 
if ($state) 
{ 
$image = imagecreatefromjpeg($images . “online.jpg”); 
} 
else 
{ 
$image = imagecreatefromjpeg($image . “offline.jpg”); 
} 
imagejpeg ($image); 
imagedestroy ($image); 
?> 

Well, try that. Then create a folder called "Images" and add online.jpg and offline.jpg

This is a simple code of PHP you just have to change the variables $server and $port. If you get some syntax error, probably is because of those quotes.

I tried to change the script to english, because the original one is on spanish. If $image doesn't run or you get error, try this:

"$ruta_img" ?> /> 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...