title | description | created | updated |
---|---|---|---|
cURL Command |
cURL is a cross platform command line tool which helps to make requests to server. Mainly used for making http calls but it can also do FILE, FTP, IMAP, LDAP, POP3, SCP, SFTP, SMTP, TELNET, TFTP and many more |
2019-06-17 |
2019-06-17 |
curl <url>
Example
curl https://onecompiler.com/
Option | Description | Example |
---|---|---|
-O |
To download a file | curl -O https://static.onecompiler.com/images/logo/logo_transparent.png |
-OC |
To download a file with resume capability | curl -OC https://static.onecompiler.com/images/logo/logo_transparent.png |
-L |
Follow url redirects | curl -L https://onecompiler.com/ |
--max-redirs |
Maximum redirects | curl -L --max-redirs 5 https://onecompiler.com/ |
-v |
Verbose mode to see request, response headers & Connection information | curl -v https://onecompiler.com/ |
-H |
To ser request headers | curl -H 'User-Agent: Robot' https://onecompiler.com/ |
-X |
To specify request method | curl -X POST https://httpbin.org/post |
Following are some of the commonly used headers with examples
- User-Agent example:
curl -H 'User-Agent: Robot' https://onecompiler.com/
- Host example:
curl -H 'Host: onecompiler.com' https://onecompiler.com/