Curl is a command line tool for doing all sorts of URL manipulations and transfers.
Curl is not written to do everything for you. It makes the requests, it gets the data, it sends data and it retrieves the information.
Trace time delay of URL with curl
Many times we need to know what exactly is taking all the time, or we just want to know the amount of milliseconds between two points in a transfer. For those, and other similar situations, the –trace-time option is what you need. It’ll prepend the time to each trace output line:
curl –trace-ascii testdebug.txt https://blog.eduguru.in/
See the Response of curl
By default, curl print the response in standard output devices. However, this can be set to save in a file with -o or -O
send User name and password with curl
Some services are setup to require HTTP authentication and then we need to provide name and password which is then transferred to the remote site in various ways depending on the exact authentication protocol used.
curl -u user:password http://blog.eduguru.in/
Curl used in GET Method of URL
The simplest and most common request or operation made using HTTP is to GET a URL.
The URL could itself refer to a web page, an image or a file. The client issues a GET request to the server and receives the document it asked for.
Multiple URLs in a single Curl command
A single curl command may may use for one or many URLs. The most common case is just use one, but you can specify any amount of URLs. There is No limits.
curl http://blog.eduguru.in http://discuss.eduguru.in
Multiple HTTP methods in a single curl command
Sometimes we need to operate on several URLs in a single command line and do different HTTP methods (GET and POST) on each.
For this, we will use –next option. It is basically a separator that separates a bunch of options from the next.
All the URLs before –next will get the same method and will get all the POST data merged into one.
When curl reaches the –next on the command line, it’ll sort of reset the method and the POST data and allow a new set.
To first send a POST and then a GET:
curl -d class=10 http://blog.eduguru.in/data1.cgi –next http://discuss.eduguru.in/results.html
[xyz-ihs snippet=”Discuss”]For any query or issue, feel free to discuss on http://discuss.eduguru.in