cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Problems downloading .asp files

From: Cris Bailiff <c.bailiff_at_awayweb.com>
Date: Thu, 19 Jul 2001 13:14:39 +1000

You are confusing the use of GET and POST parameters - input to web
applications can be in either form - its up to the application to decide
what it wants.

'-d' sends a POST paramter as input, but your example URLS show the use
of GET parameters:

> I'm trying to read web pages with financial data. I have no problem if it's
> a .php file. The URL reads
>
> http://www.pcquote.com/options/stringget.php?ticker=OEX&THEORETICALS=1&RANGE=999&SHOW=1&FIRSTMONTH=0&MONTHS=2
>
> and when I type
>
> curl -o test.pge http://www.pcquote.com/options/stringget.php -d ticker=OEX -d THEORETICALS=1 -d RANGE=999 -d SHOW=1 -d FIRSTMONTH=0 -d MONTHS=2
>
> the page downloads nicely.

This curl command is *NOT* accessing the URL you gave in the example -
its accessing only 'stringget.php', and passing the PHP parameters in
the body of the request. The curl command which accesses the url you
gave as an example would be:

curl -o test.pge
'http://www.pcquote.com/options/stringget.php?ticker=OEX&THEORETICALS=1&RANGE=999&SHOW=1&FIRSTMONTH=0&MONTHS=2'

(The quotes are to protect the '&' characters, which are special to the
shell).

Luckily for you, PHP deliberately accepts both POST and GET input and
treats it the same, so the .php page works either way. (A security
misfeature, but hey...) Unluckily for you, ASP doesn't do this - it
keeps POST and GET parameters separate. The ASP page you are accessing
is looking only for GET parameters, and you didn't send any.

> However, when I try the OEX page at CBOE (which is really the definitive page) it doesn't work. The
> URL is
>
> http://www.cboe.com/MktQuote/DelayedQuotes.asp?TICKER=OEX&PAGE=1&ALL=1&bRunQuery=true
>
> and when I type
>
> curl -o test.pge http://www.cboe.com/MktQuote/DelayedQuotes.asp -d TICKER=OEX -dPAGE=1 -d ALL=1 -d bRunQuery=true
>
> I get the following error message:
...

Ask for exactly what you want:

curl -o test.pge
'http://www.cboe.com/MktQuote/DelayedQuotes.asp?TICKER=OEX&PAGE=1&ALL=1&bRunQuery=true'

and you should get it...

Cris
Received on 2001-07-19