WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WinInet
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Specifiy HTTP User Agent


Question:

The current WinInet extender appears to web servers as Netscape 4.7x. Are there any plans to update this to IE 5.0 or higher? I'm trying to automate a process but the web server is telling me I need to use IE.

Answer:

When I in check my machine I see...

HTTP_USER_AGENT=WinBatch Internet Extender Ver: 25069

a) What version of MSIE are you running?

b) Are you setting the iOptionSet to set the user_agent in your script (or perhaps you want to start to) ???

User reply:

IE 6.00.2600.0000CO

I also get "WinBatch Internet Extender Ver: 25069" when I run iOptionGet. What are the other available values for the "user_agent" parameter in iOptionSet?

Answer:

Pretty much any string field you want. You can make it match any browser you wish.

Goto http://techsupt.winbatch.com?dumpinputdata with the browser you want WinInet to look like.

Copy the HTTP_USER_AGENT filed you want.

Paste into useragent variable in following script.

useragent="My own personal user agent to confuse web servers."   ;<<<<<<<<<<<<

fn="C:\temp\abc.html" ; filename might need changing   ;<<<<<<<<<<<<<<<<<<

AddExtender("WWINT34i.DLL")
tophandle=iBegin(0,"","")
iOptionSet(tophandle,"user_agent",useragent)   ;<<<<<<<<<<<<<<<<<<<<<<<<<<
connecthandle=iHostConnect(tophandle, "techsupt.winbatch.com",@HTTP,"", "")
datahandle=iHttpInit(connecthandle, "GET", "?dumpinputdata", "",0)
rslt=iHttpOpen(datahandle, "" , 0, 0)
xx=iReadData(datahandle,fn )
iClose(datahandle)
iClose(connecthandle)
iClose(tophandle)
ShellExecute(fn,"","",@NORMAL,"")
IntControl(54,"",1,0,0)
Message("Debug","See HTTP_USER_AGENT")
Exit

User reply:

This is good, I think I'm getting somewhere now. The value I use for "user_agent" is:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)
It is able to save the web page now.

Article ID:   W15871
File Created: 2017:07:28:13:58:46
Last Updated: 2004:03:30:15:41:18