DEV Community

sathishkumar balachandran
sathishkumar balachandran

Posted on

CURL

CURL

Command Line Utility
Used to retreive a URL from WEB using HTTP or HTTPS

Installation

sudo apt-get install curl

Image description

About Curl

Eg.,

curl https://www.onlinesbi.sbi/ --> It provides the complete HTML page of the website.

Image description

Now going to output the file from the curl command,

curl https://www.onlinesbi.sbi -o sbi.html

Image description

Common Option is : COOKIES

curl https://www.onlinesbi.sbi -c sbicookies.html

Image description
This will have cookie information ...
How we can pass the information back to the site using -b and -c ? TBD

Below one , also TBD

Image description

POST REQUEST :

curl -d "output=json"

How to check the certificate ?

curl -k --> Use this -k which is insecure to bypass the HTTPS certificate.

How to pass username and password to a URL ?

curl -u name:password

CUSTOM HEADER :

curl -H "Content-Type: application/json"

Important Notes :

  1. File name should not have any '_' like sbi_html.html --> we are unable to execute these costume name.
  2. curl -h or man curl --> Library

Top comments (0)