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?
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.
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".
The curl command sends its own user agent by default. However, it allows specifying a different user agent for its web requests.
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.
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: */*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With