Set Client User Agent with wget

Set Client User Agent with wget

When using wget for HTTP requests, specifying a User-Agent header can help identify the client making the request. The User-Agent header usually contains details about the client, including its name, version, operating system, and other relevant information. This header is utilized by various applications such as web browsers, bots, testing tools, and more. This tutorial explains how to set client user agent with wget.

With wget, you can customize the User-Agent header by using the -U or --user-agent option, followed by the desired string.

wget -qO- -U "TestingApp/1.0" https://httpbin.org/get
wget -qO- --user-agent "TestingApp/1.0" https://httpbin.org/get

In this case, the output will be formatted in JSON and will include the specified User-Agent header:

{
  "args": {}, 
  "headers": {
    "Accept": "*/*", 
    "Accept-Encoding": "identity", 
    "Host": "httpbin.org", 
    "User-Agent": "TestingApp/1.0", 
    "X-Amzn-Trace-Id": "Root=1-6416c45e-47a4828a557d5fca764271d6"
  }, 
  "origin": "XXX.XXX.XXX.XXX", 
  "url": "https://httpbin.org/get"
}

Leave a Comment

Cancel reply

Your email address will not be published.