I know how to do it in post but I don't know using GET.
Thanks
···
--
Posted via http://www.ruby-forum.com/.
I know how to do it in post but I don't know using GET.
Thanks
--
Posted via http://www.ruby-forum.com/.
Ace Mutha schrieb:
I know how to do it in post but I don't know using GET.
How do you do it in a POST request? The HTTP headers should not be
diferent between GET and POST.
Lutz
Lutz Horn wrote:
Ace Mutha schrieb:
I know how to do it in post but I don't know using GET.
How do you do it in a POST request? The HTTP headers should not be
diferent between GET and POST.Lutz
http = Net::HTTP.new('example.com', 80)
# POST request
data = 'searchaction=show&search=1'
headers = {
'User-Agent' => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.3)
Gecko/20090824 Firefox/3.5.3',
'Cookie' => cookie,
'Referer' => 'Referer: http://plain-text.info/search/',
'Content-Type' => 'application/x-www-form-urlencoded'
}
resp, data = http.post(path, data, headers)
--
Posted via http://www.ruby-forum.com/\.
Hi,
Ace Mutha schrieb:
I know how to do it in post but I don't know using GET.
This works:
headers = {'Referer' => 'Referer: http://plain-text.info/search/'\}
http = Net::HTTP.new('www.example.com', 80)
resp, data = http.get "/", headers
For details you can look here: get (Net::HTTP) - APIdock
Lutz