views:

26

answers:

4

Hi ,

I want to know what default user agent is passed if I use wget from command line without specifying explicit user agent.

I have some code which cahnges output based on user agent .

wget http://www.google.com -O test.html
A: 

On my Fedora 13 system, it shows Wget/1.12 (linux-gnu)

Raghuram
A: 

Run wget and sniff the communication.

You can also check the web server's log, usually it containts the user agent of the connecting clients.

This is what i got off the latest wget for windows: Wget/1.11.4

Am
A: 

You could verify this with a network protocol analyzer such as Wireshark. With Wireshark you can inspect the headers and every other detail of the whole protocol stack involved.

Wireshark is both free and open source: http://www.wireshark.org/

nkr1pt
A: 

At your shell prompt, do:

> man wget

scroll down to -U agent-string, which states:

"Wget normally identifies as Wget/version, version being the current version number of Wget".

So do:

> wget --version

which will give you the version, and thus your user-agent.

Incidently, you may find that some sites block wget, so depending on what you're doing you may need to change this.

Richard