Monday, April 4, 2011

wget for Windows and how to append the response to a file

wget
I've been meaning to write about wget -The awesome and easy to use webpage getter. Essentially wget goes to a URL and downloads the web response to a local file. This is really useful when you're trying to:
1. Kick off a periodic process that access a web-based application through a URL which then triggers an event in the application.
2. Download stuff off the internet like files, etc.
3. All kinds of stuff that has a web-based API...for e.g tweets!

Usage

The following downloads the response to a file on your local drive.

wget http://search.twitter.com/search.json?q=kremlin

Download
You can download wget from here.
You can download the manual from here.

Store Response to Log
If your restful web-service returns statuses of commands, try using this in your batch file

echo START >> log.txt
echo. >> log.txt
D:\utils\wget\wget --user=blah --password="blah" --no-check-certificate https://someURLyouwanttohit  -O - >> log.txt
echo. >> log.txt
echo END >> log.txt


This will append the response to a log file

No comments:

Post a Comment