Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Get domain from uri

Reply
Thread Tools

Get domain from uri

 
 
Ryan Chan
Guest
Posts: n/a
 
      10-10-2009
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?

Thanks.





 
Reply With Quote
 
 
 
 
Ryan Chan
Guest
Posts: n/a
 
      10-11-2009
On Oct 11, 2:22*am, (E-Mail Removed) 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.
 
Reply With Quote
 
 
 
 
Bart Lateur
Guest
Posts: n/a
 
      10-11-2009
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

>Ryan Chan <(E-Mail Removed)> 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:omain::TLD
http://search.cpan.org/perldoc?Net:omain::TLD

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

--
Bart.
 
Reply With Quote
 
tszming
Guest
Posts: n/a
 
      10-12-2009
On Oct 11, 11:17*pm, Ben Morrow <(E-Mail Removed)> wrote:
> Quoth Bart Lateur <(E-Mail Removed)>:
>
> No it's not. It gives you a list of valid TLDs, which is not the same.
>
> Ben



Check this out: http://search.cpan.org/perldoc?Domain:ublicSuffix
 
Reply With Quote
 
Bart Lateur
Guest
Posts: n/a
 
      10-12-2009
Ben Morrow wrote:

>> I found this:
>>
>> Net:omain::TLD
>> http://search.cpan.org/perldoc?Net:omain::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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get absolute uri by combining the baseuri and the relative uri in an html page? Turbo Javascript 2 11-01-2006 01:08 AM
Help with error: "Invalid URI: The format of the URI could not be determined." Simon Harris ASP .Net 0 05-10-2005 04:33 PM



Advertisments