Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I check what user agent curl is using?

Tags:

curl

I'm attempting using curl to monitor the contents of a page served by a remote HTTP server (which I have very little control over), and for some reason the server is returning different results depending on what machine I'm running curl from. I suspect this might be due to a difference in the user agent strings curl is using on each machine.

How do I check (not set) what user agent string curl is sending to the remote server in its HTTP requests?

like image 316
Ajedi32 Avatar asked Oct 10 '14 15:10

Ajedi32


People also ask

What user agent does curl use?

The user agent tells the server which client is performing the request. By default curl sends the curl/<version> user agent, like: curl/7.54.

How do I change user agent on curl?

You can use the -A or --user-agent command-line option to pass your own User-Agent string to Curl. By default, Curl sends its own User-Agent string to the server in the following format: "curl/version. number".

Does curl have user agent?

The curl command sends its own user agent by default. However, it allows specifying a different user agent for its web requests.

How do I know my user agent?

That's where WhatIsMyBrowser.com steps in - we decode your user agent string to figure out everything it's saying. Check out our user agent analyser page, which gives you a neat breakdown of all the things we can tell you about your browser and computer based on your user agent.


Video Answer


1 Answers

Use the --verbose option to see all the headers sent by curl, including User-Agent:

A line starting with '>' means "header data" sent by curl

For example:

$ curl --verbose 'http://www.google.com/'
> GET / HTTP/1.1
> User-Agent: curl/7.37.0
> Host: www.google.com
> Accept: */*
like image 109
TachyonVortex Avatar answered Oct 12 '22 22:10

TachyonVortex