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

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. 

主站蜘蛛池模板: 乌兰浩特市| 偏关县| 嘉峪关市| 松潘县| 金坛市| 南城县| 大余县| 思茅市| 罗甸县| 东城区| 潜江市| 会理县| 仲巴县| 大姚县| 灵川县| 板桥市| 酒泉市| 双峰县| 隆化县| 平凉市| 潼关县| 龙游县| 武冈市| 榆树市| 北海市| 伊金霍洛旗| 白水县| 咸丰县| 沁阳市| 德昌县| 会泽县| 隆化县| 金平| 庆元县| 灵石县| 潢川县| 双柏县| 章丘市| 常熟市| 青龙| 盐亭县|