I have one macro that I used to test access to https://www.dropbox.com/ and it worked for three years. But, about December 15-16, it stopped: it always gives out a HTTP status code = 400!
It reacts normally to a dozen other services. I've been fighting for 5 days, friends helped, but... Can you share your ideas?
Here is the function ('the function checks for access to the URL $ resource (file or directory)
'returns the server response code (number), or 0 if the link is invalid
'(200 - resource available, 404 - not found, 403 - no access, etc.):
Public Function GetURLstatus(ByVal URL$) As Long
On Error Resume Next: URL$ = Replace(URL$, "\", "/")
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.Open "GET", URL, "False"
xmlhttp.setRequestHeader "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"
xmlhttp.send
GetURLstatus = Val(xmlhttp.Status)
Set xmlhttp = Nothing
End Function
a fragment of a macro where this function is used:
URL$ = "https://dropbox.com/" 'directory link
If GetURLstatus(URL$) = 200 Then........
or:
MsgBox GetURLstatus(URL$), vbInformation, URL$