HTTP Request using cURL for Windows

There’s a variety of ways to perform http request without using your web browser, i.e. using your command prompt. We could use wget for most major Linux distributions, but what about Windows? Recently I’ve found out that cURL might get the job done.

cURL is a command line tool for transferring files with URL syntax. It is free and open source software. One of the use for cURL is to automate unattended file transfers. For example, automating file downloads or getting html output from sites, via a command prompt, a batch file or scheduled job. It is also a good tool for simulating a user’s actions at a web browser, thus a very good tool to perform web application tests.

How to use cURL:

1. Download cURL. Select appropriate version based on your OS.
2. Extract the zip file.
3. Place the “curl.exe” under your C:\WINDOWS directory.
4. Execute it directly from your command prompt:

C:\>curl http://www.wordpress.org

You will see a bunch of http response coming out of your command prompt.

Output http response and save the page locally :
C:\>curl http://www.mydomain.com/mypage.php > mypage.html

Downloading using cURL:
C:\>curl http://www.mydomain.com/downloads/myfile.zip

HTTP Post using cURL:
C:\>curl -d "string_to_post" http://www.mydomain.com/mypage.aspx

There’s a lot more features for cURL, and the manual usage available here.

Related Posts:

  • No Related Posts

8 Comments

  1. great tools, wget == curl…

  2. macam mano tu tak reti aa teman bermain programing ni…
    sound menarik…nak try aa gak…

  3. @dirn: Yeah, I’ve been looking for this for a while. Can do the same as wget in Linux.
    @mancai: Thank for dropping by. :) . Tak payah programming pun. Download, follow step 1-3, pas tu execute. Buleh download file mcm ni:
    C:\>curl http://www.mydomain.com/downloads/myfile.zip

  4. ooo.baru ku tahu..wget == cURL….dah lama x pakai window…hehe

  5. aku pakai fiddler. but it’s not a command line tool.

  6. Thanks, this is very useful knowledge. I have used cURL before but in PHP. I never realized it was available as a Windows command-line tool.

  7. @Rizal: PHP’s curl binding uses libcurl which originates from the same project. As a matter of fact this is one big plus feature against wget — API.

    I use curl even in Linux, especially when troubleshooting pages. As for wget, I use it to download simple files. For big files, I use lftp which has the ability to leech using multiple connections. MUAHAHAHA (evil laugh).

  8. lftp? hmm…interesting :)

Leave a Comment



  • recently written