Jump to content

PHP Ping Test


jgphp

Recommended Posts

Hello All happy new year

 

I am trying to make a php page that detects if something is plugged in to the ethernet port.

This would be complex if not impossible. I however managed to do something similar the device

that will be plugged in has a static address 192.168.1.1. so I created a ping that says if the device is up or

down.

 

function ping($host, $port, $timeout)

{

  $fP = fSockOpen($host, $port, $errno, $errstr, $timeout);

  $status;

 

  if ($fP)

  { echo "Device is ready to accept data";}

  else

  { echo "Device Down - Retrying connection"; }

 

What I would like to do is have a script that is constantly checking is the device is plugged or when it is not

(so sort of a loop or auto detect). The idea is to have an image with the device up or down.

 

Regards

and a happy new year

JG

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.