cURL provides developers with a useful toolkit to help in developing and debugging websites.
POST, GET, PUT, DELETE
cURL can handle all of these and there are libraries for most of the major programming languages. It handles most common protocols: HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE. You can use it to create functionality or write unit tests.
Viewing response headers
Let’s say you want to check the response headers of a site. Easy using cURL.
1
| |
Outputs the HTTP response headers
1 2 3 4 5 6 7 8 | |
Profiling responsiveness
cURL comes with a massive array of options. You can find these on the manpage. We can use some of these to profile the responsiveness a site. In this example we look at the Twitter API.
1
| |
We are using a number of the variables available to show how long it took to resolve the domain name, how long it took to make the connection, the pretransfer time, then how long it took to start the transfer.
The output we get is
1 2 3 4 5 6 | |
Nearly 1.6 seconds - that’s pretty slow.
You can even up your Twitter status using cURL if you want.
1
| |
cURL is a great tool for web developers and I’ll certainly be using it more.