Hypertext Transfer Protocol Overview
HTTP stands for Hypertext Transfer Protocol. HTTP was initiated by Tim Berners-Lee at CERN in 1989. This allows two nodes to communicate with each other.
The HTTP communicates between two entities: sender and receiver. The sender sends a message to the receiver. The receiver receives the message, processes it, and generates the response. If the response shows a 200 status code, meaning that the request was processed successfully. This is called data communication for World Wide Web. HTTP treats each request independently and so called stateless.
HTTPS (Hypertext Transfer Protocol Secure) is used for secure data communication. HTTPS uses HTTP on a connection encrypted by the Transport Layer Protocol(TCP).
"http://" is written in front of web address to communicate over HTTP and "https://" is written in front of web address to communicate over secure HTTP.
These are the parts of the message -
- URL - The request will contain the receiver's URL and the response will contain the sender's URL.
- The HTTP Method- GET & POST
GET - This asks the receiver about resources and the receiver usually sends this information back. The common example is asking for a webpage, where the receiver will respond with the HTML code.
POST - This means the sender wants to perform an action that will update the data the receiver is holding.
- BODY - The body part is usually present in response message even though a request message can contain it too. The body of the message contains the content of the message itself; for example, if the user requested a web page, the body of the response would consist of the HTML code that represents the page.
- HEADERS - The headers of an HTTP message are the metadata that the receiver needs in order to understand the content of the message.
- Status Code - The status code is present in response. It identifies the status of the request with a numeric code so that browsers and other tools know how to react.
200: The request was successful
202: The request is accepted
401: Unauthorized; the user does not have permission to see this resource
403: The request is forbidden
404: Page not found
500: Internal server error; something wrong happened on the server side and it could not be recovered
502: Bad gateway
504: Gateway timeout
Related ArticlesPreventing Cross Site Request Forgeries(CSRF) in PHP
PHP code to send email using SMTP
PHP MYSQL Advanced Search Feature
Simple PHP File Cache
PHP Connection and File Handling on FTP Server
Sending form data to an email using PHP
Recover forgot password using PHP and MySQL