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

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. 

主站蜘蛛池模板: 克拉玛依市| 乐昌市| 绥中县| 贵德县| 陈巴尔虎旗| 孝感市| 岳池县| 屯昌县| 乐平市| 云和县| 论坛| 丹江口市| 泰和县| 东丰县| 娄底市| 磐安县| 晋中市| 江达县| 湖口县| 平阴县| 竹北市| 太康县| 罗源县| 海林市| 莆田市| 专栏| 武陟县| 叶城县| 电白县| 梁山县| 满城县| 卢湾区| 宁城县| 双城市| 江安县| 甘孜| 天津市| 台北市| 长白| 阳曲县| 观塘区|