Replicate redirect URL building logic for post requests

This commit is contained in:
Matthew Exon 2013-07-29 22:33:10 +08:00
parent eb9bd03ef8
commit 6a38705567

View file

@ -188,7 +188,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0)
preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
$newurl = trim(array_pop($matches));
if(strpos($newurl,'/') === 0)
$newurl = $url . $newurl;
$newurl = $old_location_info["scheme"] . "://" . $old_location_info["host"] . $newurl;
if (filter_var($newurl, FILTER_VALIDATE_URL)) {
$redirects++;
return fetch_url($newurl,false,$redirects,$timeout);