Not altogether sure what problem you're running into, but http://github.com/jnunemaker/httparty has simplified a lot of my HTTP code.
require 'httparty' response = HTTParty.post("https://product-search.api.cj.com/v2/product-search", :query => {:q => 'ruby}) puts response.body Sometimes server or connection errors may inadvertently throw an "end of file reached". On May 17, 2010, at 9:48 AM, Mike Disuza wrote: > Hi, > I have written following code:- > It is working fine for http protocol. But whenever I am doing for https > I getting an error "end of file reached". > Can anyone tell me what is wrong with the code? > > def email_to_friend > require 'net/http' > require "net/https" > require 'uri' > #res = > Net::HTTP.post_form(URI.parse('http://www.test.com/'),{'q'=>'ruby'}) > res = > Net::HTTP.post_form(URI.parse('https://product-search.api.cj.com/v2/product-search'), > {'q'=>'ruby'}) > puts res.body > end > > Thanks, > Tushar -- Zach Moazeni http://simplechatter.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.