I'm trying to test URL redirection. I need to know the final URL I'm redirected to, as well as the status code of the redirection (301 or 302). If it were just the final URL, that would be easy. But the status code is more tricky. I have it working with this:
I would be great if this could "complete" the redirection after I get the status code (as this is much faster than actually opening a browser), but I can't figure out how to do it. Has anyone done anything like this?
Set oHTTP = createobject("WinHTTP.WinHTTPRequest.5.1")
'* Turn off automatic redirects
oHTTP.Option(6) = False
oHTTP.open "GET", HOSTNAME
DataTable("Status") = oHTTP.Status