You can use Ruby’s Net::HTTP
class:
require 'net/http'
url = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(url.to_s)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
puts res.body
More Related Contents:
- Regex for reverse match a string
- Ruby: How to post a file via HTTP as multipart/form-data?
- cannot load such file — script/rails : Getting this error while remote debugging through RubyMine
- How do I create a class instance from a string name in ruby?
- In Rails, how to add a new method to String class?
- Why isn’t self always needed in ruby / rails / activerecord?
- How to make an HTTP GET with modified headers?
- Resque vs Sidekiq? [closed]
- How to get class instances in Ruby? [duplicate]
- Ruby, Difference between exec, system and %x() or Backticks
- What is the difference or value of these block coding styles in Ruby?
- How to understand symbols in Ruby
- Look up all descendants of a class in Ruby
- Ruby: Inherit code that works with class variables
- incompatible character encodings: ASCII-8BIT and UTF-8
- Understanding [ClassOne, ClassTwo].each(&:my_method) [duplicate]
- ActionController::UnknownFormat
- Sort hash by key, return hash in Ruby
- I don’t understand ruby local scope
- Weird backslash substitution in Ruby
- Strange \n in base64 encoded string in Ruby
- Double Pipe Symbols in Ruby Variable Assignment? [duplicate]
- Why does Ruby’s ‘gets’ includes the closing newline?
- How do I avoid trailing empty items being removed when splitting strings?
- How do I test a function with gets.chomp in it?
- How to create directories recursively in ruby?
- what does @ stand for in a Ruby function name
- Ruby Definition of Self
- In Ruby, why does nil[1]=1 evaluate to nil?
- Customizing Devise error messages in Rails 3?