How To Set HTTP Response Header in PHP

Exception handling is very important for developer as well as for programming,in this tutorial we will described how to set custom header and messages into php response.
When we work on web application then each request have HTTP response.The HTTP response denotes the request was successful or have error,If response header contains error,Then you can know about what type error occurred with help of HTTP status code and message.

You can also check other tutorial of PHP headers,

PHP script to Set Response Headers

	 Purpose			: set header status.
	 Parameters		    : @$code: exception code
	 @$status_message : message exception

	 Returns			: app site id
	static function errorResponse($code = 400, $status_message ='')  {
			case 7:
				$code='407' ;
			case 404:
				$status_message = 'The requested URL ' . $_SERVER['REQUEST_URI'] . ' was not found.';
			case 500:
				$status_message = 'The server encountered an error processing your request.';
			case 60:
			case '190':
				$status_message = 'Token Error.';
		$status_header = 'HTTP/1.1 ' . $code . ' ' . $status_message;
header( $status_header);