cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: {NEED HELP] POST data redirected with 302

From: <tommmmmm_at_gmail.com>
Date: Sat, 20 Aug 2005 09:00:23 +0200

Dnia piątek, 19 sierpnia 2005 18:55, Ralph Mitchell napisał:
> Just a wild guess here, but if both curl *and* a web browser are being
> redirected to flotten1.php, it's because that's where the server wants you
> to go. You'd have to get to the server's code to find out why.
>
> Assuming that's impossible, the next best thing would be to load up the
> LiveHTTPHeaders extension in Firefox and track what actually happens when
> you post the form. Watch the entire transaction and see if there're any
> steps you're missing in your script. Also, examine any output returned by
> the web server and look for javascript or meta-refresh tags that send your
> browser someplace else. Your statement "after 5 seconds I'm redirected"
> suggests there's a timer in there somewhere. If so, curl won't care - it's
> not designed to...
>
> Ralph Mitchell
>
>
I have installed LiveHTTPheaders and I have fetched the headers.
The headers from webrowser are:
POST /game/flottenversand.php?session=922e97755966 HTTP/1.1
Host: ogame256.de
User-Agent: Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.7.10) Gecko/20050717
Firefox/1.0.6
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: pl,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://ogame256.de/game/flotten3.php?session=922e97755966
Cookie: U_pl13:WaCo_hacker=U_pl13%3AWaCo_hacker; AMA=1124543378;
PHPSESSID=dd9159f3d1879fd9dd4fcf7af137f946
Content-Type: application/x-www-form-urlencoded
Content-Length: 344
thisgalaxy=2&thissystem=466&thisplanet=10&thisplanettype=1&speedfactor=1&thisresource1=1655&thisresource2=222656&thisresource3=70119&galaxy=2&system=484&planet=11&planettype=1&ship203=4&consumption203=50&speed203=12000&capacity203=25000&ship204=1&consumption204=20&speed204=20000&capacity204=50&speed=10&order=1&resource1=&resource2=&resource3=
HTTP/1.x 200 OK
Date: Sat, 20 Aug 2005 05:18:54 GMT
Server: Apache/2.0.54 (Unix) PHP/4.4.0
X-Powered-By: PHP/4.4.0
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 1179
Connection: close
Content-Type: text/html
# Here is simple javascript that redirects me to flotten1.php after 5 seconds:
----------------------------------------------------------
http://ogame256.de/game/flotten1.php?session=922e97755966
GET /game/flotten1.php?session=922e97755966 HTTP/1.1
#rest of headers are not important...

When I invoke the curl like the following:
curl -A "$USER_AGENT" --referer
"http://ogame256.de/game/flotten3.php?session=$SESSION" -H "Keep-Alive: 300"
-v -b innecooki -o "$FILEONE" -d <post data here> <host here>

I'm getting the following headers:
* About to connect() to ogame256.de port 80
* Trying 212.227.76.85... connected
* Connected to ogame256.de (212.227.76.85) port 80
> POST /game/flottenversand.php?session=f067f308d024 HTTP/1.1
> User-Agent: Mozilla/5.0 (compatible; Konqueror/3.3; Linux 2.4.29; X11; i686;
pl) (KHTML, like Gecko)
> Host: ogame256.de
> Accept: */*
> Referer: http://ogame256.de/game/flotten3.php?session=f067f308d024
> Cookie: PHPSESSID=74ab6f48faf69e2fe41bb448b82d1ee2; AMA=1124543378;
U_pl13:WaCo_hacker=U_pl13%3AWaCo_hacker
> Keep-Alive: 300
> Content-Length: 344
> Content-Type: application/x-www-form-urlencoded
>
>
thisgalaxy=2&thissystem=466&thisplanet=10&thisplanettype=1&speedfactor=1&thisresource1=1655&thisresource2=222656&thisresource3=70119&galaxy=2&system=484&planet=11&planettype=1&ship203=4&consumption203=50&speed203=12000&capacity203=25000&ship204=1&consumption204=20&speed204=20000&capacity204=50&speed=10&order=1&resource1=&resource2=&resource3=HTTP/1.1
302 Found
< Date: Sat, 20 Aug 2005 07:52:05 GMT
< Server: Apache/2.0.54 (Unix) PHP/4.4.0
< X-Powered-By: PHP/4.4.0
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
< Pragma: no-cache
< Location: /game/flotten1.php?session=f067f308d024
< Vary: Accept-Encoding
< Content-Length: 0
< Connection: close
< Content-Type: text/html
  % Total % Received % Xferd Average Speed Time Time Time
Current
                                 Dload Upload Total Spent Left Speed
  0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0* Closing connection#0

The only major difference is:
resource3=HTTP/1.1 302 Found # in curl

&resource2=&resource3=
HTTP/1.x 200 OK #in webrowser

That's why I can't download the content of flottenversand.php
Now I exactly know what and why, but I still have no idea how to solve it.

Your opinions/suggestions would be welcome.

ps: I changed some values like host/user/session/AMAvalue to not steal my
account there.
Received on 2005-08-20