官术网_书友最值得收藏!

HTTP request methods

There are nine current HTTP request methods, which define a general action desired by the client. Each method carries a particular connotation as to how the server should process the request. The nine request methods are as follows:

  • GET
  • POST
  • PUT
  • DELETE
  • HEAD
  • CONNECT
  • TRACE
  • OPTIONS
  • PATCH

The most common request methods that you will need are GET, POST, and PUTGET requests are used for retrieving information from a website. POST and PUT requests are for sending information, such as user login data, to a website. These types of requests are usually sent only when submitting some type of form data, which we will cover in later chapters in this book.

In building a web scraper, the vast majority of the time you will be sending HTTP GET requests to a server in order to get a web page. The simplest example of a GET request for http://example.com/index.html looks something like this:

GET /index.html HTTP/1.1
Host: example.com

The client sends this message to the server with the GET action to obtain the index.html resource using the 1.1 Version of the HTTP protocol. This first line of an HTTP request is called the request line and is the core of an HTTP request. 

主站蜘蛛池模板: 磴口县| 巴南区| 洮南市| 开原市| 中方县| 昌宁县| 南木林县| 栾城县| 塔河县| 肃宁县| 寻甸| 麻栗坡县| 江陵县| 霍州市| 前郭尔| 武隆县| 建德市| 连州市| 汾西县| 崇州市| 阿拉尔市| 普宁市| 区。| 南丰县| 司法| 合江县| 左贡县| 全南县| 汶川县| 图片| 东乌珠穆沁旗| 商水县| 托里县| 北川| 温州市| 鹰潭市| 修水县| 湖北省| 怀远县| 东辽县| 灌云县|