0

I am trying to open and read output of php script it looks like: domain.com/scripts/script.php?assetid=xxxxx&checksum=yyyy when I open this in any browser it works fine. So I tried to use open-uri gem to get output - returns code 200 no output. I tried

Net::HTTP.post_form('domain.com/scripts/script.php', {'assetid'=>'xxxxx', 'checksum'=>'yyyy'}) 

without desired output. Can you help me choose correct way to open and parse this uri ?

Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367
user2925656
  • 383
  • 4
  • 17

1 Answers1

0

If you are getting 200, you are getting your result.

uri = URI('http://example.com/index.html')
params = { :limit => 10, :page => 3 }
uri.query = URI.encode_www_form(params)

res = Net::HTTP.get_response(uri)
puts res.body if res.is_a?(Net::HTTPSuccess)

This straight from ruby documentation

If you are doing web scraping, you will want to use the ruby gemMechanize.

zhon
  • 1,610
  • 1
  • 22
  • 31