PHP code for GET Request Custom Headers ExampleThis PHP code snippet was generated automatically for the GET Request Custom Headers example.
<< Back to the GET Request Custom Headers example
What is HTTP?
Hypertext Transfer Protocol (HTTP) is a network protocol that transfers data between an HTTP client (browser or mobile app) and a server. An HTTP message consists of a request or response line, HTTP headers, and a message body. The client generates a request and sends it to the server. After the server processes this request, it generates a response and sends it back to the client.
What are HTTP Headers?
HTTP headers allow clients to send some information to the server and return some information to the client. HTTP headers are usually invisible to the end-user and are only visible to server soft and network administrators. HTTP headers include a case-insensitive name followed by a colon ":" and its value. Spaces before the value are ignored.
What are Custom Headers?
Custom headers are intended to provide additional information related to the current request or response, or for troubleshooting purposes. Custom header fields usually have an X-field name appended, but this convention has been deprecated due to the inconvenience that some custom fields have become standard.
What is GET request?
HTTP GET is one of the nine standard HTTP methods. GET is used to request resources from the server using the provided URI. GET requests only receive data and should not change the state of the server.
GET Request with Custom Headers Example
The following is an example of a GET request with Custom Headers to the ReqBin echo URL:
The server response to our GET request: