In this tutorial, we will answer a perplexing question.
In order to communicate, they must share a common language. On the web, clients and servers must speak HTTP. On top of that the browser must know HTML.
They must share a common language in order to communicate. Clients and servers on the web must communicate using HTTP. Furthermore, the browser must be familiar with HTML.
In the line “Clients and servers on the web must communicate using HTTP,” we said web. The Internet is a global network of connected computers and servers, while the web (short for “World Wide Web”) is a collection of interconnected documents and other resources, linked by hyperlinks and URLs. The web is accessed via the Internet, but the two terms are not interchangeable. The Internet is the infrastructure and the web is one of the services built on top of it.
Now, let’s get back to HTTP and HTML.
HTML instructs the browser on how to display/present the content to the user.
HTTP is the web protocol that clients and servers use to communicate.
The server sends HTML to the client using HTTP.
Let’s first give you a general overview of “How it works” before getting into the specifics of HTTP and HTML.
For the time being, consider the web to be a road. On one end of the road, like your house, is the client. The server, which is a shop where you want to buy something, is at the other end of the road. When you enter a web address into your browser (as if you were walking to the store):
1. The browser connects to the DNS server to determine the true address of the server where the website is hosted (you find the address of the shop).
2. The browser sends an HTTP request message to the server, asking it to send the client a copy of the website (you go to the shop and order your goods). This message, as well as all other data exchanged between the client and the server. TCP/IP is used to send it across your internet connection.
3. If the server approves the client's request, it sends the client a message ". "200 OK" means "Of course you can look at that website! It's right here ", and then begins sending the website's files to the browser in the form of a series of small chunks known as data packets (the shop gives you your goods, and you bring them back to your house).
4. The browser assembles the small chunks into a complete web page for you to view (the goods arrive at your door).
When a server responds to a request, the server typically sends the browser some kind of content so the browser can display it. Servers often send the bowser a set of instructions written in HTML, the HyperText Markup Language. The HTML instructs the browser on how to show the user the content.
All web browsers know what to do with HTML, though occasionally an older browser may struggle to comprehend certain elements of a page that were created using a more recent version of HTML.
HTML (Hypertext Markup Language) is the standard language used for creating web pages. It is a markup language, which means that it is used to describe the structure and layout of a document, rather than its appearance.
HTML documents are made up of elements, which are represented by tags. These tags describe the different types of content on a web page, such as headings, paragraphs, images, and links. For example, the <h1> tag is used to create a level-1 heading, the <p> tag is used to create a paragraph, and the <img> tag is used to insert an image.
HTML also includes a set of attributes, which can be used to provide additional information about an element. For example, the src attribute is used to specify the source of an image, and the href attribute is used to specify the link destination of a hyperlink.
HTML documents are typically viewed in web browsers, which interpret the HTML code and display the content on the screen. They can be created using a simple text editor, and saved with the .html or .htm file extension.
When creating a web page, HTML is used to describe how the page should look and behave
HTML, as previously stated, has dozens of tags and hundreds of tag attributes. HTML’s goal is to take a text document and add tags that instruct the browser on how to format the text. Below are the tags we use in the next several tutorials. We recommend HTML Tutorial – W3Schools if you need a more in-depth understanding of HTML.
Assume you’re designing a login page. The basic HTML could look something like this:
<html> <!-- Some Sample HTML --> <head> <title>A Sample HTML Page</title> </head> <body> <h1 align="center">Geek's Sample HTML Page</h1> <p align="right"> <img src="https://images.pexels.com/photos/161702/harmony-relax-rock-moqui-161702.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" alt="A pic of rock" width="130" height="140"/> </p> <form action="someAction" method="GET"> Name: <input type="text" name="param1"/><br><br> Password: <input type="text" name="param2"/><br><br> <center> <input type="submit"/> </center> </form> </body> </html>
The browser reads through the HTML code, creates the web page, and displays it to the user.
Relax, you only need the most basic knowledge.
The majority of web-based communications between clients and servers take place over the HTTP protocol, which supports simple request and response conversations. The server responds to the client’s HTTP request with an HTTP response. In conclusion, if you are a web server, you are fluent in HTTP. A web server uses HTTP to send an HTML page to the client.
HTTP is built on top of TCP/IP. If you’re unfamiliar with those networking protocols, here’s a primer: TCP is in charge of ensuring that a file sent from one network node to another arrives at the destination as a complete file, even if the file is split into chunks when it is sent. The underlying protocol that moves/routes the chunks (packets) from one host to the next on their way to the destination is IP.
HTTP is another network protocol with Web-specific features, but it relies on TCP/IP to transfer the entire request and response from one location to another. An HTTP conversation has a simple Request/Response sequence: a browser requests, and a server responds.
Remember HTTP (Hypertext Transfer Protocol) is a web protocol, not a network protocol. It is the foundation of data communication for the World Wide Web and it is used to transmit data between a web browser and a web server. HTTP defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands. It is an application layer protocol that runs on top of the Transmission Control Protocol (TCP) and Internet Protocol (IP), which are network protocols.
HTTP is a protocol used by web clients and servers to communicate.
It’s similar to other internet protocols like SMTP (Simple Mail Transfer Protocol) and FTP (File Transfer Protocol).
Below is a list of important characteristics of HTTP Protocols.
Client-Server Model: HTTP uses a client-server model, where the client (typically a web browser) sends a request to the server (a web server), and the server sends a response back to the client.
Stateless: HTTP is a stateless protocol, each connection can only handle a single request. As a consequence, clients using HTTP connect to the server, send a single request, and then disconnect. More users can connect to a particular server over time thanks to this mechanism. Each request and response in HTTP is independent of the others, which means that the server does not maintain any information about previous requests from the client.
Request-Response: HTTP uses a request-response model, where the client sends a request message to the server, and the server sends a response message back to the client.
Methods: HTTP defines several methods, such as GET, POST, PUT, and DELETE, that indicate the desired action to be performed on the requested resource.
Status Codes: HTTP uses a set of standard status codes to indicate the outcome of a request. Examples include 200 OK for a successful request, and 404 Not Found for a request that could not be fulfilled.
Headers: HTTP defines a set of headers that can be used to provide additional information about the request or response, such as the accept-language header, which indicates the preferred language of the client.
URI: HTTP uses a URI (Uniform Resource Identifier) to identify the resource to be requested or acted upon.
In its most basic form, the HTTP architecture can be represented as follows:
HTTP messages are made up of textual information encoded in ASCII that spans multiple lines. These textual HTTP messages are typically generated by software, such as a Web browser, proxy, or Web server. These textual HTTP messages are rarely created by web developers themselves.
The structure of HTTP request and response messages will be discussed in the following tutorial.