Bug #77314 [Com]: When doing a http-post-request with a redirect, the post-data is not sent again

From: Date: Mon, 17 Dec 2018 20:59:04 +0000
Subject: Bug #77314 [Com]: When doing a http-post-request with a redirect, the post-data is not sent again
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218505@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77314&edit=1 ID: 77314 Comment by: spam2 at rhsoft dot net Reported by: cyberbeat at gmx dot de Summary: When doing a http-post-request with a redirect, the post-data is not sent again Status: Open Type: Bug Package: *Network Functions Operating System: Opensuse PHP Version: 7.2.13 Block user comment: N Private report: N New Comment: that simply can't work predictable because params in the redirect-url and hidden fields of the previous post request collides - who should win and why and what result would be the outcome? what when the page redirects to a 3rd party for whatever reason and you submit sensible post data there? Previous Comments: ------------------------------------------------------------------------ [2018-12-17 20:52:15] cyberbeat at gmx dot de Description: ------------ I make a post request to an url, and get a redirect (to the https version of the page) as a response. In such case, the post data should be sent again to the https-url. But the post data seems not to be sent in the second request. With CURL (with follow-location-option) this case is handled as expected. Test script: --------------- <?php $postdata = http_build_query( array( 'var1' => 'some content', 'var2' => 'doh' ) ); $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); $result = file_get_contents('http://example.com/submit.php', false, $context); ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77314&edit=1

« previous php.bugs (#218505) next »