protected function curl_parse ( $response )
	{
		if (empty($response))
		{
			return array();
		}
	
		@list($headers,$body) = explode("\r\n\r\n",$response,2);
		$lines = explode("\r\n",$headers);

		if (preg_match('@^HTTP/[0-9]\.[0-9] +100@', $lines[0]))
		{
			/* HTTP/1.x 100 Continue
			 * the real data is on the next line
			 */
			@list($headers,$body) = explode("\r\n\r\n",$body,2);
			$lines = explode("\r\n",$headers);
		}
	
		// first line of headers is the HTTP response code 
		$http_line = array_shift($lines);
		if (preg_match('@^HTTP/[0-9]\.[0-9] +([0-9]{3})@', $http_line, $matches))
		{
			$code = $matches[1];
		}
	
		// put the rest of the headers in an array
		$headers = array();
		foreach ($lines as $l)
		{
			list($k, $v) = explode(': ', $l, 2);
			$headers[strtolower($k)] = $v;
		}
	
		return array( 'code' => $code, 'headers' => $headers, 'body' => $body);
	}
protected function curl_parse ( $response )
	{
		if (empty($response))
		{
			return array();
		}
	
		@list($headers,$body) = explode("\r\n\r\n",$response,2);
		$lines = explode("\r\n",$headers);

		if (preg_match('@^HTTP/[0-9]\.[0-9] +100@', $lines[0]))
		{
			/* HTTP/1.x 100 Continue
			 * the real data is on the next line
			 */
			@list($headers,$body) = explode("\r\n\r\n",$body,2);
			$lines = explode("\r\n",$headers);
		}
	
		// first line of headers is the HTTP response code 
		$http_line = array_shift($lines);
		if (preg_match('@^HTTP/[0-9]\.[0-9] +([0-9]{3})@', $http_line, $matches))
		{
			$code = $matches[1];
		}
	
		// put the rest of the headers in an array
		$headers = array();
		foreach ($lines as $l)
		{
			list($k, $v) = explode(': ', $l, 2);
			$headers[strtolower($k)] = $v;
		}
	
		return array( 'code' => $code, 'headers' => $headers, 'body' => $body);
	}
protected function curl_parse ( $ response ) { if ( empty ( $ response ) ) { return array ( ) ; } @ list ( $ headers , $ body ) = explode ( "\r\n\r\n" , $ response , 2 ) ; $ lines = explode ( "\r\n" , $ headers ) ; if ( preg_match ( '@^HTTP/[0-9]\.[0-9] +100@' , $ lines [ 0 ] ) ) { /* HTTP/1.x 100 Continue
			 * the real data is on the next line
			 */ @ list ( $ headers , $ body ) = explode ( "\r\n\r\n" , $ body , 2 ) ; $ lines = explode ( "\r\n" , $ headers ) ; } // first line of headers is the HTTP response code  $ http_line = array_shift ( $ lines ) ; if ( preg_match ( '@^HTTP/[0-9]\.[0-9] +([0-9]{3})@' , $ http_line , $ matches ) ) { $ code = $ matches [ 1 ] ; } // put the rest of the headers in an array $ headers = array ( ) ; foreach ( $ lines as $ l ) { list ( $ k , $ v ) = explode ( ': ' , $ l , 2 ) ; $ headers [ strtolower ( $ k ) ] = $ v ; } return array ( 'code' => $ code , 'headers' => $ headers , 'body' => $ body ) ; }
Parse an http response

@param string response the http text to parse
@return array (code=>http-code, headers=>http-headers, body=>body)
Parse an http response