PHP: Remove header data (strip_header) function

This is a simple function I have used numerous times to simplify the process of stripping the header data which is normally found at the top of most web server requests and responses. I normally use this function if I am working with fsockopen and need to remove the response header before processing the response.

/*
 * Strips header data from provided data
 * By Shane Rutter (shane@shanerutter.co.uk)
 * http://shanerutter.co.uk
 */
function strip_header($data){
	return substr($data, strpos($data,"\r\n\r\n")+4);
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.