DEV Community

Cover image for Curl In 5 Min
Alestor Aldous
Alestor Aldous

Posted on

Curl In 5 Min

So What is Curl ??

Curl is a cli tool for making http from terminal it allows us to use other protocols such as FTP

CURL - Client URL

Simple Get Request Using Curl

curl http://www.name.domain

by default it will log the output or if you want to save response as a file use -o argument

Example

curl -o output.html http://www.name.domain

Also

curl http://www.name.domain > output.html

For Specifying URL use

curl -s http://www.name.domain

For POST method

curl -d '{"name":"John","surname":"Doe"}'\http://www.name.domain

The -X flag specifies a custom request method to use when communicating with the HTTP server. By default, the GET method is used unless some other method is specified.

Setting User Agent


curl --user-agent "Mozilla/4.73 [en] (X11; U; Linux 2.2.0 i686)" http://www.name.domain

Conclusion

yeah every one should know how to use curl

Keep Coding !!!

🙏 Share with your friends on Twitter

👇 Find more posts on the following topics

Top comments (0)