mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
Update DoPostRequest() in itoprest.examples.php to fix optional headers like in utils::DoPostRequest
This commit is contained in:
@@ -49,12 +49,12 @@ function DoPostRequest($sUrl, $aData, $sOptionnalHeaders = null, &$aResponseHead
|
|||||||
if ($sOptionnalHeaders !== null)
|
if ($sOptionnalHeaders !== null)
|
||||||
{
|
{
|
||||||
$aHeaders = explode("\n", $sOptionnalHeaders);
|
$aHeaders = explode("\n", $sOptionnalHeaders);
|
||||||
|
// N°3267 - Webservices: Fix optional headers not being taken into account
|
||||||
|
// See https://www.php.net/curl_setopt CURLOPT_HTTPHEADER
|
||||||
|
$aHTTPHeaders = array();
|
||||||
foreach($aHeaders as $sHeaderString)
|
foreach($aHeaders as $sHeaderString)
|
||||||
{
|
{
|
||||||
if(preg_match('/^([^:]): (.+)$/', $sHeaderString, $aMatches))
|
$aHTTPHeaders[] = trim($sHeaderString);
|
||||||
{
|
|
||||||
$aHTTPHeaders[$aMatches[1]] = $aMatches[2];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Default options, can be overloaded/extended with the 4th parameter of this method, see above $aCurlOptions
|
// Default options, can be overloaded/extended with the 4th parameter of this method, see above $aCurlOptions
|
||||||
|
|||||||
Reference in New Issue
Block a user