mechanize.cr/main.cr

14 lines
416 B
Crystal
Raw Normal View History

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-26 07:46:50 +02:00
params = {"hoge" => "hoge"}
2021-05-27 00:40:25 +02:00
page = agent.get("http://example.com/", params: params)
2021-08-17 18:30:01 +02:00
# form = page.forms[0]
# query = {"foo" => "foo_value", "bar" => "bar_value"}
# page = agent.post("http://example.com/", query: query)
# puts page.code
# puts page.body
# puts page.css("h1").first.inner_text
# puts page.title