cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: {NEED HELP] POST data redirected with 302

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Fri, 19 Aug 2005 20:28:41 +0200 (CEST)

On Fri, 19 Aug 2005, tommmmmm_at_gmail.com wrote:

> I'm trying to send POST data to flottenversand.php but i'm getting
> redirected and the post data is being sent (?) to flotten1.php which I do
> not want to happen.
>
> Firstly I tried wget, but obviously "Note: if Wget is redirected after the
> POST request is completed, it will not send the POST data to the redirected
> URL."

Does it say that? A proper HTTP client should do what the response code
says...

> I also tried curl. I did make all settings apropriate, but it seems that the
> POST data is not being sent to flottenversand.

Nope. It seems there's a 302 returned and HTTP response code 302 is (as
RFC2616 section 10.3.3 and 10.3.4 explains) treated as a 303 for backwards
compliance with how old user-agents used to do it. Which means when when
following a Location: and a 302, curl makes the next request a GET no matter
what the previous one was.

> If I submit the form with webbrowser, I see the flottenversand.php ( its
> content depends on what was sent in form) and then after 5 seconds i'm
> redirected to flotten1.php

If so, then I suspect that the site responds with different contents when you
do that with the browser. The response headers you showed here should redirect
immediately.

> Let me apologize one more time for being so selfish ans asking just like
> that.

This is the kind of things we use curl for and we don't consider it rude to
ask about it. I'm convinced you can make curl do what you want.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-08-19