cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Query string not working using cURL

From: G. T. Stresen-Reuter <tedmasterweb_at_gmail.com>
Date: Sat, 1 May 2010 09:38:15 +0100

On May 1, 2010, at 1:00 AM, ubuntu serv.user wrote:

> Thanks for your reply. You mentioned that it worked fine for you. What OS are you using & what version of curl? What output do you get?
>
> I still get the same garbage back.

Odd, I know get a blank document. I followed the link in a browser and see that it has many redirects. I'm going to guess that one of those redirects sets a cookie and if the destination of the redirects fails to find the cookie, no data are returned.

Sorry I can't be more help. I guess this wasn't one I could answer after all!

Ted

>
> Thanks,
> Scott
>
> On Thu, Apr 29, 2010 at 1:10 AM, G. T. Stresen-Reuter <tedmasterweb_at_gmail.com> wrote:
> Hi and welcome to the list!
>
> On Apr 29, 2010, at 1:58 AM, ubuntu serv.user wrote:
>
> > I've read the cURL tutorial (http://curl.haxx.se/docs/httpscripting.html)
> >
> > When I navigate to the following in a browser:
> >
> > http://www.kayak.com/s/search/air?do=y&ft=rt&ns=y&cb=e&pa=1&l1=MSP&t1=e&df=us1&d1=05/20/2010&l2=PHX&t2=e&d2=05/23/2010&b=US
> >
> > I get the results back that I expect.
> >
> > When I type the below in the terminal window from my computer running Ubuntu Desktop 9.10:
> >
> > curl -d "do=y&ft=rt&ns=y&cb=e&pa=1&l1=MSP&t1=e&df=us1&d1=05/20/2010&l2=PHX&t2=e&d2=05/23/2010&b=US" http://www.kayak.com/s/search/air
> >
> > I get the following back (garbage):
>
> From the man page:
>
> -d/--data <data>
> (HTTP) Sends the specified data in a POST request to the HTTP server, in the same way
> that a browser does when a user has filled in an HTML form and presses the submit
> button. This will cause curl to pass the data to the server using the content-type
> application/x-www-form-urlencoded. Compare to -F/--form.
>
> -d/--data is the same as --data-ascii. To post data purely binary, you should instead
> use the --data-binary option. To URL-encode the value of a form field you may use
> --data-urlencode.
>
> If any of these options is used more than once on the same command line, the data
> pieces specified will be merged together with a separating &-symbol. Thus, using '-d
> name=daniel -d skill=lousy' would generate a post chunk that looks like
> 'name=daniel&skill=lousy'.
>
> If you start the data with the letter @, the rest should be a file name to read the
> data from, or - if you want curl to read the data from stdin. The contents of the
> file must already be URL-encoded. Multiple files can also be specified. Posting data
> from a file named 'foobar' would thus be done with --data @foobar.
>
>
>
> What that means is that the "form values" of the request are sent to the server using a POST method.
>
> Try just plain-jane curl URL as in:
>
> curl "http://www.kayak.com/s/search/air?do=y&ft=rt&ns=y&cb=e&pa=1&l1=MSP&t1=e&df=us1&d1=05/20/2010&l2=PHX&t2=e&d2=05/23/2010&b=US"
>
> and it should work just fine (just did for me).
>
> Ted Stresen-Reuter
>
> (Finally, a question I'm able to answer!)
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-users
> FAQ: http://curl.haxx.se/docs/faq.html
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-users
> FAQ: http://curl.haxx.se/docs/faq.html
> Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-05-01