GENWiki

Premier IT Outsourcing and Support Services within the UK

User Tools

Site Tools


php:get_headers_from_curl_response
function get_headers_from_curl_response($headerContent) {
 
    $headers = array();
    $arrRequests = explode("\r\n\r\n", $headerContent);
    for ($index = 0; $index < count($arrRequests) -1; $index++) {
    	foreach (explode("\r\n", $arrRequests[$index]) as $i => $line)
    	{
    		if ($i === 0)
    			$headers[$index]['http_code'] = $line;
    		else
    		{
    			list ($key, $value) = explode(': ', $line);
    			$headers[$index][$key] = $value;
    		}
    	}
    }
    return $headers;
}
/data/webs/external/dokuwiki/data/pages/php/get_headers_from_curl_response.txt · Last modified: 2019/05/20 10:17 by genadmin