Javier's Blog

Mostly computers and other tech stuff,...

Thursday, September 07, 2006

1st Dive into Ruby

So here's a bit of code that demonstrates how to download a web page:

require 'net/http'
require 'html-parser'

url = URI.parse('http://www.sdsu.edu/')
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) {|http|http.request(req)}

puts res.body

Any suggestions on how to get just the links or any tag in particular?


Post a Comment

<< Home