1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| Function URLexiste(urlStr)
Dim xmlHttp
Dim retStr
Set xmlHttp = Server.CreateObject("Msxml2.XMLHTTP")
'Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
'Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.4.0")
Err.Clear
'On Error Resume Next
xmlHttp.Open "HEAD", urlStr, False, "LOGIN", "PASSWORD"
xmlHttp.setRequestHeader "Content-Type", _
"application/x-www-form-urlencoded"
xmlHttp.send
If Err.Number = 0 Then
lapage = xmlHttp.responseText
If xmlHttp.Status = 404 Or xmlHttp.Status = 401 Then
'If InStr(LCase(lapage), "404") <> 0 Or xmlHttp.Status = 401 Then
URLexiste = False
Else
URLexiste = True
End If
Else
URLexiste = False
End If
Set xmlHttp = Nothing
End Function |
Partager