I basically am tasked with scraping a website using a post request. I was looking to
“net/http” in ruby and the post examples seem pretty straightforward. The question is if I want to find a store of a chain using zipcode ( chain website uses post to find the store), how can I do it? I have tried couple of stuff but none of them worked.Below is a sample of the code I am using:
url = ARGV[0]
zipcode = ARGV[1]
params = {"q" => "#{zipcode}"}
result = Net::HTTP.post_form(URI.parse("#{url}"),params)
I pass url and zipcode as arguments from command line where url is the store locator url of a chain.
Considering using Mechanize instead.
http://mechanize.rubyforge.org/