Get domain from uri

Discussion in 'Perl Misc' started by Ryan Chan, Oct 10, 2009.

  1. Ryan Chan

    Ryan Chan Guest

    Ryan Chan, Oct 10, 2009
    #1
    1. Advertising

  2. Ryan Chan

    Ryan Chan Guest

    On Oct 11, 2:22 am, wrote:

    > What are the criteria for whether you go 2- or 3-deep to
    > get what you consider to be the domain?
    >


    Think about Alexa, they map subdomains (with many level) into a single
    domain and generate the ranking

    e.g.

    http://uk.finance.yahoo.com => yahoo.com


    What I want to do is something like that.
    Ryan Chan, Oct 11, 2009
    #2
    1. Advertising

  3. Ryan Chan

    Bart Lateur Guest

    wrote:

    >Ryan Chan <> writes:
    >
    >> Hello,
    >>
    >> I want to get the domain from uri, e.g.
    >>
    >> http://www.example.com/index.html => example.com
    >> http://foo.example.com/index.html => example.com
    >> http://foo.example.co.uk/index.html => example.co.uk
    >> http://foo.example.company.com => company.com
    >> http://foo.example.company.com.hk => company.com.hk
    >>
    >> It seems that URI module does not have this feature yet, any
    >> recommendation?

    >
    >What are the criteria for whether you go 2- or 3-deep to
    >get what you consider to be the domain?
    >
    >As it stands, there doesn't seem to be a purely syntactic
    >solution, you'll need knowledge of how each TLD is
    >organized.


    Oh, I would totally have missed the original question, if it wasn't for
    this reply.

    I found this:

    Net::Domain::TLD
    http://search.cpan.org/perldoc?Net::Domain::TLD

    which is a module to reduce a domain name to its core domain name.

    --
    Bart.
    Bart Lateur, Oct 11, 2009
    #3
  4. Ryan Chan

    tszming Guest

    tszming, Oct 12, 2009
    #4
  5. Ryan Chan

    Bart Lateur Guest

    Ben Morrow wrote:

    >> I found this:
    >>
    >> Net::Domain::TLD
    >> http://search.cpan.org/perldoc?Net::Domain::TLD
    >>
    >> which is a module to reduce a domain name to its core domain name.

    >
    >No it's not. It gives you a list of valid TLDs, which is not the same.


    You seem to be right... It was wishful thinking on my side.

    --
    Bart.
    Bart Lateur, Oct 12, 2009
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Harris
    Replies:
    0
    Views:
    6,362
    Simon Harris
    May 10, 2005
  2. Stanimir Stamenkov
    Replies:
    1
    Views:
    2,461
    Stanimir Stamenkov
    Aug 17, 2005
  3. Pavel
    Replies:
    2
    Views:
    1,634
    Peter Flynn
    Aug 4, 2004
  4. etheriau
    Replies:
    1
    Views:
    665
    Pavel
    Aug 23, 2004
  5. Turbo
    Replies:
    2
    Views:
    156
    Turbo
    Nov 1, 2006
Loading...

Share This Page