How to retrieve the HTTP response contents like header, posts, HTML, etc.?

Dear All:

I am trying to deal with the HTTP response. I want to retrieve the
contents such as header, post, response, HTML, JSON, etc. of the HTTP
response.
(Please refer screen shot for the same.)

Please tell me how to retrieve these contents?

Thanks,
Amit.

use typhoeus gem

Amit B. wrote in post #1001502:

Dear All:

I am trying to deal with the HTTP response. I want to retrieve the
contents such as header,

resp.each_header do |name, value|
puts “#{name} => #{value}”
end

puts response[‘content-type’]

post,

What is a response ‘post’?

response

The response is the response.

HTML, JSON, etc. of the HTTP
response.

puts resp.body

(Please refer screen shot for the same.)

I don’t think so.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs