I'm trying to retrieve data from an embedded web server. (It's actually a MicroLogix 1100 industrial PLC.) The embedded server seems to only authenticate properly with Internet Explorer. I want to query the server with an ASP script and parse the result so I'm trying to use Lynx (the Windows version of the text only browser) to make the query and give back the result. According to the Lynx manual I should be able to pass the authorisation parameters like so:
Code:
lynx -dump -auth=username:password http://ipaddress/dataview?offset=30&format=4
where
-dump tells Lynx to dump the output and terminate (rather than open up the browser),
-auth=username: password (without the space) is the authorisation string,
http:... is the page and parameters I'm trying to retrieve.
Here's what IE sends to the server on page reloads after the first authorization (and it gets the desired response).
Code:
GET /dataview.dat?offset=30&format=4 HTTP/1.0
Accept: */*
Accept-Language: en-gb
Pragma: no-cache
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; MS-RTC LM 8)
Host: 10.62.112.176
Authorization: Digest username="administrator", realm="1763-L16BWA B/5.00", qop="auth", algorithm="MD5", uri="/dataview.dat", nonce="a4b8c8d7e0f6a7b2c3d2e4f5a4b7c5d2e7f", nc=00000002, cnonce="e9030a7ee879a901f5ed6a6f3f2e1719", response="27f77336cfc0b56724cc32122c53accb"
Here's my Lynx attempt:
Code:
C:\Lynx>lynx -dump -auth=administrator:ml1100 http://123.123.123.123/dataview.dat
Looking up 123.123.123.123
Making HTTP connection to 123.123.123.123
Sending HTTP request.
HTTP request sent; waiting for response.
Alert!: Can't retry with authorization! Contact the server's WebMaster.
Can't Access `http://123.123.123.123/dataview.dat'
Alert!: Unable to access document.
lynx: Can't access startfile
Has anyone any ideas how to replicate the IE authentication in Lynx?
Alternately - and maybe even better - is there a way to do this within ASP - preferably with some distributable code.