Retrieve Page Contents via Http Get using Ruby
Posted November 27th, 2007 by administrator
This script retrieves the content of url and dumps it to the output .
Example copy this script into file named : get_page.rb
#!/usr/bin/ruby
require 'net/http'
host,port,url = ARGV
http = Net::HTTP.new(host, port)
STDERR.puts "url {#url}"
response, data = http.get(url)
puts data
Usage
ruby get_page.rb <host> <port> <url>
The url is specified as a relative path
ruby get_page.rb livrona.com 80 /news/home













Comments
Post new comment