Jump to content

PHP Script to Ping an IP Address


Recommended Posts

PHP doesn't have a way to create pings - unless you want to craft the packets yourself.


Quick answer: make a script that runs Windows' ping with its usual 4 attempts, parses the output to see how many were returned, and uses sc

sc start 
to start the service if necessary.
Link to comment
Share on other sites

I want o write a script in php to ping an IP address. Scenario is that If ping fails, it should run a window service on the same system. ping must repeat 3-4 times every 30 second. Please help me in this problem. Thanks 

Interested in what your attempting to achieve?  Are you trying to get some form of failover, if so there are some more tried and reliable methods out there.

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

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

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.