Hey, I searched on google and read in the ruby manuals, but I couldn't find a way to use WWW::Mechanize and NET::HTTP::GET over a socks4 proxy.
I read, that WWW::Mechanize is a subclass of the UserAgent module, and that therefore the ->proxy() method would work. But the manual only talks about http, ftp and gopher proxy.
Any ideas how to support socks4? Here are the code snippets:
def get_request(url_in)
url = URI.parse(url_in)
req = Net::HTTP::Get.new(url.path, {"User-Agent" => $UserAgent})
res = Net::HTTP.start(url.host, url.port) { |http|
http.request(req)
}
return res.body
end
agent = WWW::Mechanize.new
agent.user_agent_alias('Windows Mozilla')
page = agent.get("urlhere")
post_form = page.form('post')
Thanks for reading