Ruby Requests

The easy way, work with hpricot:

  • require 'hpricot'
  • require 'open-uri'
  • doc = Hpricot(open("http://www.naturalinputs.com/query?q=lunch+tomorrow"))
  • puts doc

OR If you want to work with the xml yourself:

  • require 'net/http'
  • res = Net::HTTP.start('www.naturalinputs.com',80) {|http| http.get('/query?q=lunch+tomorrow')}
  • puts res.body