go to bug id or search bugs for
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.
$postdata = http_build_query(
'var1' => 'some content',
'var2' => 'doh'
$opts = array('http' =>
'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);
Add a Patch
Add a Pull Request
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?
As far as I know, cURL will not automatically re-POST data to the new URL - you have to opt-into that with the CURLOPT_POSTREDIR flag.
Since the pure PHP version operates at a lower level than what the cURL API provides, the equivalent would be checking the response code and repeating the request with the new location.
Oh, you are right, I have set CURLOPT_POSTREDIR=7, sorry. But perhaps such an option would make sense for php http contexts, too?