FoxPro Programming
Check to see if a website is up or down
Gravatar is a globally recognized avatar based on your email address. Check to see if a website is up or down
  Marvin Masson
  All
  Jul 19, 2024 @ 04:33am

This is topical - Is there a VFP function / utility to determine if we website is up or down? We have several down today it and would be good if we could determine when the go offline or comeback online. Thanks!

Gravatar is a globally recognized avatar based on your email address. re: Check to see if a website is up or down
  Rick Strahl
  Marvin Masson
  Jul 19, 2024 @ 09:12am

Sure you can do this with any HTTP client like wwHttp:

DO wwhttp
loHttp = CREATEOBJECT("wwhttp")
loHttp.nTimeout = 2  && seconds
lcHTML = loHttp.Get(lcUrl)

IF (loHttp.nError # 0 OR ATC("search string",lcHtml) > 0)
   ? "Request failed: " + loHttp.cErrorMsg
   return
ENDIF

Actually with wwHttp there's a dedicated method:

llResult = loHttp.httpPing(2, lcUrl)

These are useful if you want to check whether a site is up before making calls inside of an application.

But for monitoring and notification etc., the the bigger issue is the scheduling and timing. Generally you should use a Web site monitor. There are many commercial online tools, or if you want to run something on your own without subscriptions, there's our West Wind Web Monitor.

Gravatar is a globally recognized avatar based on your email address. re: Check to see if a website is up or down
  Marvin Masson
  Marvin Masson
  Jul 19, 2024 @ 12:18pm

I like the way the West Wind Web Monitor uses a text string to validate whether the site is us vs. a ping. Thanks!

© 1996-2024