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:
You will see a bunch of http response coming out of your command prompt.
Output http response and save the page locally :
curl http://www.mydomain.com/mypage.php > mypage.html
Downloading using cURL:
HTTP Post using cURL:
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.
great tools, wget == curl…
macam mano tu tak reti aa teman bermain programing ni…
sound menarik…nak try aa gak…
@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:
ooo.baru ku tahu..wget == cURL….dah lama x pakai window…hehe
aku pakai fiddler. but it’s not a command line tool.
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.
@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).
lftp? hmm…interesting 🙂