Hiya folks. Just trying out a form post with multiple parameters. Not
sure if I’m running into some syntax issues or other issues. I’m
getting a bad reply, error code 500.
Questions:
- Are my parameters done correctly? The documentation is a bit
confusing. - Is there a specific method how I can test this sort of thing?
- what is the parse on the url do?
===============
require ‘net/http’
require ‘uri’
target = “http://example.com/srch.do”
uri = URI.parse(target)
params = Hash.new
params.store(“lang”, “eng”)
params.store(“profileId”, “”)
params.store(“prtl”, “1”)
params.store(“searchCriteriaBean.portal”, “1”)
params.store(“V_SEARCH.documentJSP”,
“/retrieveEstablishmentIdFromVerity.do”)
params.store(“searchPage”,
“cccSrch.do%253Flang%253Deng%2526prtl%253D1%2526tagid%253D”)
params.store(“searchCriteriaBean.resultJsp”, “/results.do”)
params.store(“exportCsvLang”, “”)
params.store(“V_SEARCH.scopeCategory”, “CCC.Root”)
params.store(“V_SEARCH.depth”, “1”)
params.store(“V_SEARCH.showStricts”, “false”)
params.store(“searchCriteriaBean.textField”, “fish”)
params.store(“sbmtBtn”, “Search”)
params.store(“searchCriteriaBean.conceptOperator”, “and”)
params.store(“searchCriteriaBean.hitsPerPage”, “10”)
params.store(“searchCriteriaBean.sortSpec”, “title+asc”)
params.store(“searchCriteriaBean.isSummaryOn”, “Y”)
res = Net::HTTP.post_form(uri, params)
Status
puts res.code # => ‘200’
puts res.message # => ‘OK’
puts res.class.name # => ‘HTTPOK’
Body
puts res.body
Any advice appreciated. Cheers