Sending a request to a server
When you want to retrieve data from a web server, you send a GET request to the server. When sending a request, the URL will contain information on the resource from which you want data. The URL can be broken down into a few key parts. These include the protocol, the hostname, the URI, and the query parameters. The format of it looks like this:
Figure 17.1: URL format breakdown
We can see the following in this example:
Protocol
tells the client how to connect to the server. The two most common protocols are HTTP and HTTPS. In this example, we have usedhttps
.Hostname
is the address of the server we want to connect to. In this example, it isexample.com
.URI
is the uniform resource identifier (URI), and this tells the server the path to the resource we want. In this example, it is/downloads
.Query Parameters
tells the server about any additional information it needs. In this example, we have two query...