viewpoint-particle

Author Topic: Quick way to validate a URL?  (Read 149 times)

snowsnowsnow

  • Sr. Member
  • ****
  • Posts: 313
Quick way to validate a URL?
« on: April 04, 2020, 04:48:39 pm »
I am in the planning states now for a script that will need to "validate" a series of URLs.

By "validate", I mean verity that the URL exists (i.e., that if I loaded it into a browser, it would work).  Obviously, I could just load it into a browser (via keystrokes) and see if it works, but I am hoping for something built-in to WB (e.g., in an extender).

Does that exist?

JTaylor

  • Pundit
  • *****
  • Posts: 1362
    • Data & Stuff Inc.
Re: Quick way to validate a URL?
« Reply #1 on: April 04, 2020, 06:17:38 pm »
If you just want a way to verify URLs then this might help (can load from a file even though the web page doesn't mention that)...

         http://www.jtdata.com/jturl.html

doesn't really help if you need the script itself but thought I would throw it out there.  It is free.

Jim

stanl

  • Pundit
  • *****
  • Posts: 1171
Re: Quick way to validate a URL?
« Reply #2 on: April 05, 2020, 03:31:36 am »
A series of WinHttp.WinHttpRequest.5.1 requests and record either the status or response text. Could be a simple UDF and several examples of usage on Tech Database. Below is a quick way to check if your version of either WB or Windows supports:


Code: Winbatch

cURL='urltocheck'
oHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
oHTTP.Open("GET", cURL, @FALSE)
oHTTP.Send()
oHTTP.WaitForResponse()
response = oHTTP.ResponseText