HTTP header in PHP

Spread the love

HTTP Header:

In the web application the communication you do with server are mainly through browsers. And browser in actual communicates with server using HTTP header.

When you send a request for any web page to the server, a server returns the page along with some more information which is an HTTP header. This information contains the type of the browser which makes a request, date of the request, MIME type of data, the location of the web page and lot more.

HTTP header also gives information about the status of the request. Like whether the page is present or not, if not found then returns 404 error status message. Every time you visit any web page, headers are used.

You can also send header using PHP’s header() function.

A common example of is sending location URL in header function, which when gets called redirect you to the web page.

Example: header(“Location:http://codingkala.com/php-tutorial”);

You can use header function with Location information whenever you want to redirect to another script or web page inside your web application.

 


Spread the love

Leave a Comment