Change User Agent on cURL

Windows Articles

Is ReactOS a real alternative to Windows?

Oh! The eternal struggle of computer operating systems. Windows vs. GNU/Linux and Mac as a distant spectator However, there are also interesting...

How to install Firebird on Ubuntu 20.04/ 18.04?

Database management systems are sufficient for many kinds of projects. Of course, they abound with MySQL / MariaDB or PostgreSQL popular but...

How to disable Firewall in Windows Server 2019/2016

Hello! The Firewall performs an essential security task on any version of Windows Server. In fact, it has the mission of preventing...

How to install ArangoDB on Ubuntu 20.04?

In this post, you will learn how to install ArangoDB on Ubuntu 20.04 So let's go for it What...

How to create GPO in Windows Server 2019.

Hi, in today's post we will be looking at GPOs in Windows Server 2019. The Group Police Object are a set of...
Mel Khamlichi
Mel Khamlichihttp://www.osradar.com
Founder of Osradar, from Amsterdam Netherlands

cURL is a really useful tool for Linux users. This tool can easily download all the files from the internet over lots of supported protocols – FTP, HTTPS, IMAP, POP3, RTSP, SMB, SMTP, SCP, DICT etc. and lot more. That’s why it’s my favorite tool to download files from the internet instead of “wget”. When you use cURL, the server sees you as a browser requesting file access. Now, let’s take a look how to change the user agent of cURL.

When connecting to the server, the program sends a data like this – “Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0”. The server identifies that you’re using Firefox (although you’re not). You can set out the option of your favorite browser as user-agent of the cURL tool.

Changing the user-agent

In cURL, the syntax for changing the user-agent follows this structure –

curl -A "user-agent-name-here" url
curl --user-agent "user-agent-name-here" url
curl -H "User-Agent: user-Agent-Name-Here"

The user agent also follows this structure –

Mozilla/[version] ([system and browser information]) [platform] ([platform details]) [extensions]

In this command line example, I’ll be using Firefox as the user-agent of cURL for connecting with OSRadar.

$ curl -A "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" https://www.osradar.com/
$ curl -I -A "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" https://www.osradar.com/

If you want to use your user-agent as Safari, use this command line –

curl -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (K HTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36" https://www.osradar.com/

Enjoy cURL!

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Is ReactOS a real alternative to Windows?

Oh! The eternal struggle of computer operating systems. Windows vs. GNU/Linux and Mac as a distant spectator However, there are also interesting...

How to install Firebird on Ubuntu 20.04/ 18.04?

Database management systems are sufficient for many kinds of projects. Of course, they abound with MySQL / MariaDB or PostgreSQL popular but...

How to disable Firewall in Windows Server 2019/2016

Hello! The Firewall performs an essential security task on any version of Windows Server. In fact, it has the mission of preventing...

How to install ArangoDB on Ubuntu 20.04?

In this post, you will learn how to install ArangoDB on Ubuntu 20.04 So let's go for it What...

How to create GPO in Windows Server 2019.

Hi, in today's post we will be looking at GPOs in Windows Server 2019. The Group Police Object are a set of...