From: Gustav - Railist Date: 2006-09-05T23:34:34+09:00 Subject: Re: how do i get a url's domain Logan Capaldo wrote: > > On Sep 5, 2006, at 10:02 AM, Gustav - Railist wrote: > >> Hey! >> >> Can anybody tell me if there's a way to find what the domain of a url >> is ? >> I was thinking somehow using Net::HTTP? >> >> e.g. >> >> del.icio.us => icio.us >> -or- >> mrboulder.blogspot.com => blogspot.com >> >> Thanks! >> >> Gustav >> > > require 'uri' > uri = URI.parse( 'http://del.icio.us' ) > puts uri.host > > Unfortunately you can't get more fine grained than that without asking > DNS. Why? Because ruby can't know all the top-level domains. > Makes perfect sense, does anyone know how to ask DNS for a url then? Thanks G > > > --No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.405 / Virus Database: 268.11.7/437 - Release Date: 9/4/2006 > >