Helper for HTTP POSTs: can return the headers if requested

SVN:trunk[2971]
This commit is contained in:
Romain Quetiez
2013-11-06 15:29:15 +00:00
parent 898c235c0d
commit 3f50d3ea59

View File

@@ -889,7 +889,7 @@ class utils
* @return string The result of the POST request
* @throws Exception
*/
static public function DoPostRequest($sUrl, $aData, $sOptionnalHeaders = null)
static public function DoPostRequest($sUrl, $aData, $sOptionnalHeaders = null, &$aResponseHeaders = null)
{
// $sOptionnalHeaders is a string containing additional HTTP headers that you would like to send in your request.
@@ -928,6 +928,11 @@ class utils
{
throw new Exception("Problem reading data from $sUrl, $php_errormsg");
}
if (is_array($aResponseHeaders))
{
$aMeta = stream_get_meta_data($fp);
$aResponseHeaders = $aMeta['wrapper_data'];
}
return $response;
}
}