Using WGET with HTTP GET Parameters

WGET is a simple tool that is usually on a lot of shell boxes. I think it might be installed by default on Linux. Sometimes you have to get it installed by your admin.

At any rate, it’s useful for downloading a resource from a simple web service like so:

WGET http://www.asdf.com/jkl.html

You can even attach parameters to it

WGET http://www.google.com/search?q=asdf

Just be sure that if you attach two or more parameters, you enclose the command in quotes; otherwise the shell thinks the command ends at the ampersand and your request won’t go through correctly.

WGET “http://www.imf.org/external/np/fin/data/rms_mth.aspx?SelectDate=2008-09-30&reportType=SDRCV”

20 Comments

  • Martin
    Posted August 4, 2009 at 9:11 am | Permalink

    thx

  • Sharon
    Posted September 3, 2010 at 2:13 pm | Permalink

    I’ve been looking for this information!!!

  • Posted December 12, 2010 at 2:29 pm | Permalink

    Great tip .. now the process is working … Many thanks …

  • Posted January 13, 2011 at 7:09 pm | Permalink

    hah, i actually had this problem again, and searched for it, and came upon my own blog entry.

  • Roman
    Posted November 24, 2011 at 8:44 am | Permalink

    Thanks!

  • xdave
    Posted June 17, 2012 at 1:31 pm | Permalink

    thanks, useful info for me

  • Maduka
    Posted March 21, 2013 at 4:11 am | Permalink

    Thanks mate 🙂

  • Z
    Posted May 10, 2013 at 8:22 pm | Permalink

    Thanks, very very useful.
    I had problems with it.

    Thanks again

  • Adnan
    Posted June 28, 2013 at 6:48 am | Permalink

    I have to pass 4 parameters like that but it is not working because it once sends call with first parameter and then displays all other passed parameters on console and I have used double quote around the path even.

    • philihp
      Posted July 8, 2014 at 6:09 am | Permalink

      Escape your ampersand.

  • manju
    Posted June 20, 2014 at 9:05 am | Permalink

    Thanks ton. it helped a lot!

  • Jwebuser
    Posted August 21, 2014 at 7:44 pm | Permalink

    Thank, you, that was exactly what I searched and it workes great. 😉

  • Lolo
    Posted October 30, 2014 at 7:41 am | Permalink

    Thanks !

  • Fran
    Posted December 25, 2014 at 9:47 pm | Permalink

    I’m trying to download this image using wget.

    wget -c -o log “http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=165261&type=card”

    But I get an invalid parameter error mesage. Any ideas??
    Thanks a lot.

  • Thomas
    Posted January 21, 2015 at 2:13 pm | Permalink

    gooooood

  • Thomas
    Posted February 4, 2015 at 12:25 am | Permalink

    “Just be sure that if you attach two or more parameters, you enclose the command in quotes; otherwise the shell thinks the command ends at the ampersand and your request won’t go through correctly.”

    Wow!! Seriously !!! ?!! i spent about 3 hours searching all around the world about why my crontab wasnt working … Thoses quotes … really … can’t believe it.

    Thank you so much …

    • philihp
      Posted March 3, 2015 at 2:41 am | Permalink

      You’re welcome 🙂 It’s a common stupid mistake, but not so common enough to warrant updating the doc to assume users like us are stupid.

  • Joydeep
    Posted March 31, 2015 at 12:25 pm | Permalink

    Nice tip. How to wget http://dotcms.com/download/download-now.dot?file=/xxx/yyy/zzz.tar.gz. Tried this and wget creates a file by the encoded name of the query string.

    • philihp
      Posted April 21, 2015 at 8:57 am | Permalink

      You could rename the file after it downloads it.

  • RSWOrld
    Posted June 30, 2017 at 6:15 am | Permalink

    Thanks man you saved my day

Post a Comment

Your email is kept private. Required fields are marked *