2021-04-30 14:37:41 +02:00
|
|
|
require "./src/mechanize.cr"
|
|
|
|
|
|
|
|
agent = Mechanize.new
|
2021-05-01 16:22:37 +02:00
|
|
|
agent.request_headers = HTTP::Headers{"Foo" => "Bar"}
|
2021-05-22 10:18:18 +02:00
|
|
|
#params = {"hoge" => "hoge"}
|
|
|
|
#page = agent.get("http://example.com/", params: params)
|
|
|
|
query = {"foo" => "foo_value", "bar" => "bar_value"}
|
|
|
|
page = agent.post("http://example.com/", query: query)
|
2021-05-05 04:49:14 +02:00
|
|
|
#puts page.code
|
2021-05-22 10:18:18 +02:00
|
|
|
puts page.body
|
2021-05-05 04:49:14 +02:00
|
|
|
#puts page.css("h1").first.inner_text
|
2021-05-05 08:53:39 +02:00
|
|
|
#puts page.title
|