Javascript,Nodejs,MongodDB,WordPress,CSS,PHP

LightBlog

Sunday, August 26, 2018

What is curl


cURL is a command-line tool for getting or sending files using URL syntax.
Since cURL uses libcurl, it supports a range of common Internet protocols, currently including HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, LDAP, DAP, DICT, TELNET, FILE, IMAP, POP3, SMTP and RTSP (the last four only in versions newer than 7.20.0 or 9 February 2010).
cURL supports HTTPS and performs SSL certificate verification by default when a secure protocol is specified such as HTTPS. When cURL connects to a remote server via HTTPS, it will first obtain the remote server certificate and check against its CA certificate store the validity of the remote server to ensure the remote server is the one it claims to be. Some cURL packages have bundled with CA certificate store file. There are several options to specify CA certificate such as --cacert and --capath. The --cacert option can be used to specify the location of the CA certificate store file. In the Windows platform, if a CA certificate file is not specified, cURL will look for a CA certificate file name “curl-ca-bundle.crt” in the following order:
  1. Directory where the cURL program is located.
  2. Current working directory.
  3. Windows system directory.
  4. Windows directory.
  5. Directories specified in the %PATH% environment variables.[7]
cURL will return an error message if the remote server is using a self-signed certificate, or if the remote server certificate is not signed by a CA listed in the CA cert file. -k or --insecure option can be used to skip certificate verification. Alternatively, if the remote server is trusted, the remote server CA certificate can be added to the CA certificate store file.

Example of curl command 

1) open your command prompt 
create a directory using this command 
> mkdir folderName
then go to folderName usign this command
> cd folderName
>folderName>
then type in cmd 
>folderName>curl example.com
where example.com is a domain name
you will see source code of homepage on your cmd

cURL can write the output it retrieves to a file with the -o flag, thus:

curl -o example.html www.example.com
 where: example.html is file name and www.example.com is domain name

if you want to know more about cur you can visit on this link Curl


No comments:

Post a Comment