HostArmada Web Hosting Knowledge Base

Knowledge is power! Use that power and achieve total and unconditional control over the Web Hosting Services!

The curl command.

The curl command is going to allow you to transfer data from your hosting over a large number of protocols the server supports. Please do not mistake it with libcurl as both are entirely different things. Libcurl is a development library while curl is a command-line interface tool. To familiarize yourself with a few of curl's options, please read this article. Note that we cannot cover all of the available options as there are over 170 curl command-line flags.

Here is the most basic syntax you should follow when using it:

curl <option> <URL>

First, let's not use any options for our first example and explain what happens in this case:


The output is big and unreadable, but basically, what it does is it shows you the content of the website in an HTML format. You are going to receive the same information as when you press the right-click in your browser and then "View page source". A handy feature of curl is the ability to download files from an URL. To do that, you need to add the "-o" option. Please refer to the example below:

curl -o 

When you type this command, this is the result you are going to receive:

[[email protected] ~]# curl -o
 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10.0M  100 10.0M    0     0   257M      0 --:--:-- --:--:-- --:--:--  263M 

If you do not want to name the file, you are downloading, please use the "-O" (capital o) option:

curl -O 

Another useful application of curl is being able to execute scripts from the command-line interface. This option is great when setting up cron jobs for automating tasks. To do that, please use the "-s" option:

curl -s 

Typically, within the "script.php", you can define a piece of code that clears the cache of your application, generates new RSS feed or performs any task you need once or multiple times a day. The last example we are going to show you using curl is the option to query HTTP headers. You can do that by adding the "-I" flag to the command, followed by the URL:

[[email protected] home]# curl -I
HTTP/1.1 200 OK
Date: Fri, 13 Mar 2020 10:27:23 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
P3P: CP="This is not a P3P policy! See for more info."
Server: gws
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
Set-Cookie: 1P_JAR=2020-03-13-10; expires=Sun, 12-Apr-2020 10:27:23 GMT; path=/;; Secure
Set-Cookie: NID=200=Upcp-YVD1RGFTiH4MsWWvCz01UbG-nDA4G7k0CjSwmn2KRg9xhbD7nQrMiSq7D1gnvNhflcQrUitPr6wySFMBRiSH3uFDU44sHzGFfD9x_jmE2MHHGWkCKc96SOveanUhu6ldAZ4OChAopGSmebCL5GKFlsKpIJ3D62_soTEuOk; expires=Sat, 12-Sep-2020 10:27:23 GMT; path=/;; HttpOnly
Transfer-Encoding: chunked
Accept-Ranges: none
Vary: Accept-Encoding 

As you can see, this shows you the HTTP response, the date, cache-control, content type, along with other useful information you can use for your applications.

Was this article useful and on point?

Find out more about HostArmada entire range of optimized Web Hosting Services and take action today on improving your website Loading Speed, Security, and overall Stability!