Mark Thomas
9/30/2008 2:42:00 PM
On Sep 30, 7:45 am, Keith Langdon <ke...@masite.co.uk> wrote:
> Hi, using the great rest-client from Adam Wiggins, but I can't seam to
> be able work out how to get just the HEAD of a URL.
> i.e. in curl I would : curl -I URL
>
> I'm getting the data just fine with:
> return_data = RestClient.get "URL"
>
> Is there a way of doing this, or should I go about it a different way?
The ruby standard library has net/http, with which you can do:
require 'net/http'
conn = Net::HTTP.start('www.whatever.com')
conn.head('/').each_header do |k,v|
puts "#{k} = #{v}"
end
-- Mark.