WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

UDFs

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

UDF to Test Existence of a URL


; Winbatch 2005B - UDF to test existence of a URL
; Stan Littlefield, March 3, 2005
; modify to suit your needs
; //////////////////////////////////////////////////////////////
#DefineFunction TestUrl(cURL)
If StrSub( StrUpper(cURL),1,4) <> "HTTP" Then Return(2) 
oXMLHTTP = CreateObject("MSXML2.XMLHTTP") 
oXMLHTTP.Open( "GET" ,cURL, @False) 
oXMLHTTP.Send("") 
retval = (oXMLHTTP.statusText == "OK") 
oXMLHTTP = 0
Return(retval)
#EndFunction

:start
cURL = AskLine("URL Status","Enter URL To Test (include http:// or https://)","http://")

n = TestUrl(cURL)
If n==2 Then goto start
If n==1 Then Display(2,cURL,"is alive and well")
Exit 

Article ID:   W17136
File Created: 2007:07:03:14:28:26
Last Updated: 2007:07:03:14:28:26