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

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. 

主站蜘蛛池模板: 晴隆县| 军事| 昭觉县| 金乡县| 德安县| 安龙县| 六枝特区| 抚顺市| 松滋市| 定边县| 平谷区| 建平县| 漳浦县| 义马市| 岚皋县| 阿合奇县| 冀州市| 新乡市| 乐东| 鄂温| 八宿县| 和龙市| 黎城县| 安康市| 澄江县| 西峡县| 康平县| 博湖县| 桓仁| 刚察县| 宣威市| 阳泉市| 白银市| 江西省| 肇源县| 香港 | 苏尼特左旗| 密山市| 泾源县| 南投市| 额尔古纳市|