DrDamnit
asked on
Capture Headers
I figured out (thanks to the EExperts) how to log into my router. Now, I want to catch the headers that initiate the HTTP authentication. THe point is that I want to catch the Basic Realm from the authentication header.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If the late binding doesn't work...Then you need to add a reference to Microsoft WinHTTP. However the latebinding should work.
DrDamnit, this is just in support of egl's answer. I don't want points for this.
egl, that works for me. But you will want to comment out the setcredentials line to force the server to return a 401 status, because the header he wants is only returned when authentication is required but not present. Also, the httprequest object doesn't seem to take the username:password URL syntax, so you may as well get rid of it. But it's a good job of showing how to use the httprequest object to login as well, that works quite nicely. :)
egl, that works for me. But you will want to comment out the setcredentials line to force the server to return a 401 status, because the header he wants is only returned when authentication is required but not present. Also, the httprequest object doesn't seem to take the username:password URL syntax, so you may as well get rid of it. But it's a good job of showing how to use the httprequest object to login as well, that works quite nicely. :)
PaulHews, Could be used to get the WAN IP as well. Although for personal use only.
The positions will be off though.
WanPos1 = InStr(router_body, "WAN:")
WanStr1 = Mid$(router_body, WanPos1, 310)
WanPos2 = InStr(WanStr1, "IP Address:")
WanStr2 = Mid$(WanStr1, WanPos2, 120)
Erase RemoveString
Dim strFix As String
RemoveString = Split("<->- -td-font-v erdana- /-size=-/ face=-/-tr-bgcolor=-;", "-")
For I = LBound(RemoveString) To UBound(RemoveString)
WanStr2 = Replace(WanStr2, RemoveString(I), "")
Next I
MsgBox Mid(WanStr2, 14, 21)
WanPos1 = InStr(router_body, "WAN:")
WanStr1 = Mid$(router_body, WanPos1, 310)
WanPos2 = InStr(WanStr1, "IP Address:")
WanStr2 = Mid$(WanStr1, WanPos2, 120)
Erase RemoveString
Dim strFix As String
RemoveString = Split("<->- -td-font-v
For I = LBound(RemoveString) To UBound(RemoveString)
WanStr2 = Replace(WanStr2, RemoveString(I), "")
Next I
MsgBox Mid(WanStr2, 14, 21)