Skip to content

Instantly share code, notes, and snippets.

@duper
Created January 29, 2011 05:01
Show Gist options
  • Save duper/801554 to your computer and use it in GitHub Desktop.
Save duper/801554 to your computer and use it in GitHub Desktop.
def webget(ur, fn)
=begin
File.open(fn, 'wb'){|f|
Net::HTTP.get_response(URI.parse(ur)){|r|
r.read_body{|c|
f.write(c)
}
}
}
=end
str = ''
fil = File.open(fn, 'wb')
res = Net::HTTP.get(URI.parse(ur))
fil.write(res.body)
fil.close
str
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment