1

I want to send a CURL GET request to retrieve information from a web server and trick the webserver to think that I am sending the request from:

  1. Android phone
  2. iPhone
  3. iPad
  4. Smart TV (optional)
  5. Desktop Windows

The webserver has rules set up and depending on the requesting device it should serve different information or return 404. I want to test if those rules are indeed set correctly. I think I can trick it by manipulating the request header, but not sure how to do it.

Georgi Stoyanov
  • 594
  • 1
  • 9
  • 26

1 Answers1

2

The User-Agent header is used to differentiate device types / browsers. You can set headers on a cURL command with the -H parameter.

This question / answer shows an example how to set the User-Agent header to act as a chrome browser: How to use curl to get a GET request exactly same as using Chrome?

Here is a site that maintains a list of user-agent strings for various platforms and browsers: https://developers.whatismybrowser.com/useragents/explore/

Simon McLoughlin
  • 8,293
  • 5
  • 32
  • 56