Web Scraping v R
Timo Grossenbacher
Instructor

Požadavek je odeslán na webový server

Typické stavové kódy: 200 (OK), 404 (NOT FOUND), 3xx (přesměrování), 5xx (chyby serveru)
Odpověď je přijata od webového serveru

GET /index.html)POST /test HTTP/1.1
Host: foo.example
Content-Type: application/x-www-form-urlencoded
Content-Length: 27
field1=value1&field2=value2
Požadavky POST jsou také zodpovězeny odpovědí!
library(httr)
GET('https://httpbin.org')
Response [https://httpbin.org/]
Date: 2020-09-19 13:02
Status: 200
Content-Type: text/html; charset=utf-8
Size: 9.59 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
...
library(httr)
response <- GET('https://httpbin.org')
content(response)
{html_document}
<html lang="en">
[1] <head>\n<meta http-equiv="Content-Type" content="text/html; charset=UTF ...
[2] <body>\n <a href="https://github.com/requests/httpbin" class="github ...
Web Scraping v R