0

I want to fetch instances of this web page via a script which injects variations of the parameters into HTTP POST.

Using the Firefox Tamper Data extension, I captured a sample request. Here are the raw headers (Content-length and gzip Accept-encoding omitted)

Host: www.fourmilab.ch
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
DNT: 1
Referer: http://www.fourmilab.ch/cgi-bin/Yoursky
Connection: keep-alive

Similarly, the raw post data is this

date=1&utc=2010-02-24+0%3A00%3A00&jd=2455251.50000&lat=47%B0&ns=North&lon=7%B0&ew=East&coords=on&moonp=on&deep=on&deepm=2.5&consto=on&constn=on&limag=5.5&starnm=2.0&starbm=2.5&imgsize=1200&fontscale=0.7&scheme=0&elements=

I used these to construct a wget command which should, as far as I understand it, return the same web page that the browser would see.

wget --header="Host: www.fourmilab.ch" --header="User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0" --header="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" --header="Accept-Language: en-US,en;q=0.5" --header="DNT: 1" --header="Referer: http://www.fourmilab.ch/cgi-bin/Yoursky" --header="Connection: keep-alive" -data "date=1&utc=2010-02-24+0%3A00%3A00&jd=2455251.50000&lat=47%B0&ns=North&lon=7%B0&ew=East&coords=on&moonp=on&deep=on&deepm=2.5&consto=on&constn=on&limag=5.5&starnm=2.0&starbm=2.5&imgsize=1200&fontscale=0.7&scheme=0&elements=" -o /dev/null -O - http://www.fourmilab.ch/cgi-bin/Yoursky > /tmp/sky.html

The server is not responding as expected.

The result in-browser is that the web page's form fields will be pre-populated with the same values as were in the original request, so if you hit the Update button again you will cycle the same result.

When I run the wget version, it returns the default initial web page, as if we were doing GET and not requesting any particular parameters.

Am I using wget incorrectly? Or incompletely? Why isn't it getting the same result as the browser?

4
  • wget doesn't have the -data command line option
    – golimar
    Feb 25, 2016 at 9:32
  • Ah, thanks. I was copying from an example with different command options. D'oh. Care to make that an answer I can accept?
    – spraff
    Feb 25, 2016 at 21:06
  • Maybe it's better to remove the question as it's too specific
    – golimar
    Feb 26, 2016 at 8:31
  • 1
    I'm voting to close this question as off-topic because I made a silly mistake.
    – spraff
    Feb 26, 2016 at 9:44

0

You must log in to answer this question.

Browse other questions tagged .