فهرست منبع

Helper for HTTP POSTs: can return the headers if requested

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2971 a333f486-631f-4898-b8df-5754b55c2be0
romainq 11 سال پیش
والد
کامیت
6ca267b84c
1فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 6 1
      application/utils.inc.php

+ 6 - 1
application/utils.inc.php

@@ -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;
 	}
 }