I wrote the following command to send a POST with JSON data to the server. The server should redirect my request and send a GET with the same data:
curl -L -i -XPOST \ -d 'id=105' \ -d 'json={"orderBy":0,"maxResults":50}' http://mysite.com/ctlClient/
I get the answer:
HTTP/1.1 302 Found Date: Thu, 04 Jul 2013 13:12:08 GMT Server: Apache X-Powered-By: PHP/5.3.19 Set-Cookie: PHPSESSID=1hn0g8d7gtfl4nghjvab63btmk2; path=/ 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: http://mysite.com/fwf/online/ Content-Length: 0 Connection: close Content-Type: text/html HTTP/1.1 200 OK Date: Thu, 04 Jul 2013 13:12:08 GMT Server: Apache X-Powered-By: PHP/5.3.19 Set-Cookie: PHPSESSID=16akc7kdcoet71ipjflk9o9cnm5; path=/ 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 Content-Length: 1 Connection: close Content-Type: text/html
From the access log I see:
"POST /ctlClient/ HTTP/1.1" 302 - "-" "Apache-HttpClient/4.1 (java 1.5)" "GET /fwf/online/ HTTP/1.1" 200 1 "-" "Apache-HttpClient/4.1 (java 1.5)"
So far so good
The problem is that GET not receiving my data added to the message. It seems that during the redirect, my data was somehow fired. It works from the Android client, so its problem is not on the server side.
What do I need to do to pass POST data to a GET request?
Thank you very much,
[EDIT]
@nif suggest updating CURL , I did, to 7.28.0.
Still having the same problems
[INFO]
The first time I will go to http://mysite.com/ctlClient/index.php where:
case 105: // id=105 session_unset(); session_start(); foreach($_POST as $key => $value){$_SESSION[$key] = $value;} ctlGotoSameDomain("/fwf/online/"); // <- aka redirect return true;
after redirecting, I go to /fwf/online/index.php and there my request is empty:
public function __construct() { $this->json = isset($_SESSION['json']) ? $_SESSION['json'] : null; msqLogFile("fwf/post", Array('post' => 'Request: '.$this->json)); }
http://mysite.com/ctlClient/index.php correctly get 2 parameters: id and json