Hi,
I'm struggling to figure out a work around for some network devices queries.
I am hitting their internal web gui, and extracting info by reading a list of IPs.
A very large majority of them I see redirect the default IP address to a sub page w/o HTML extension.
It doesn't seem to bother iHttpOpen, and reads the home page just fine.
However, there is ONE model that redirects to a sub page with an extension of IP/Device_Info.html.
example: 10.22.33.44/Device_Information.html
When I hit that IP with a standard web browser it redirects to the Device_information.html just fine.
If I manually force the optional sub URL in the iHttpInit using referrer option, it queries the page just fine.
But if I can't query the home page to determine the model number, then I don't know to use the URL referrer option.
I'm getting a 200 OK on the read w/o the option, and about 94 bytes of data read.
The typical read is about 5 to 10k bytes, incl this device when I use the sub URL with .html.
Is there a way for iHttpInit or iHttpOpen to tell me where the site sent me, so I can change the iHttpInit to hit that redirected url directly ?
Thanks,
CadJoe
WinBatch, Gotta Love It !!
So I tried this to see what it showed.
iOptionGet(datahandle,"url")
still shows root IP address.
Thanks,
CadJoe
WinBatch, Gotta Love It !!
so I did an iRead on it to see what the 94 bytes was.
<html><head><META HTTP-EQUIV="REFRESH" CONTENT="0; URL=Device_Information.html"></head></html>
Not sure why the redirect works on all the other newer devices, and why iHttpOpen doesn't read this one.
Is there anyway to detect this w/o having to start a new handle / connection / open ?
Thanks,
CadJoe
WinBatch, Gotta Love It !!
You likely need a browser or a programmable equivalent to handle "HTTP-EQUIV" redirect pragmas much like you need for processing javascript. The WinInet extender is not a browser. It handles HTTP verbs and FTP commands.
ok, thanks.
I just threw it into a binary buf, and did a BinaryIndexEx search for the redirect.
If it exists, I close the buf, and just go directly to the .html and throw into buf again, then proceed like normal.
Thanks,
CadJoe
WinBatch, Gotta Love It !!
Good plan.