473,394 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

subdomains on a domain. Can someone help me?

Hi friends..

Is it possible to find subdomains on a domain. Can someone help me?

currently i'm using this code..


Expand|Select|Wrap|Line Numbers
  1. private static String GetSubDomain(URL url)             
  2.     {
  3.               String host = url.getHost().toString();
  4.          Pattern p = Pattern.compile("[.]");
  5.         String u[]=p.split(url.getAuthority());
  6.         if (u.length > 2)
  7.           {
  8.             int lastIndex = host.lastIndexOf(".");
  9.            int index = host.lastIndexOf(".", lastIndex - 1);
  10.  
  11.            return host.substring(0, index);
  12.          }
  13.              return null;
  14.     }
but it is not working for some domains like http://www.mail.yahoo.co.in and http://www2.austin.cc.tx.us

Any help will be greatly appreciated.. thanks
Feb 18 '08 #1
1 3323
Plater
7,872 Expert 4TB
What do you mean by "it doesn't work"? Does it "miss" sections of the url that should be listed.
What are you considering a domain and what a subdomain? When you get down to it, pretty much everything is a subdomain. thescripts is a subdomain of the .COM domain. And you can trace higher to the arpa domains and such too.
Feb 18 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: craigkenisston | last post by:
In an application I'm developing I will be using subdomains in the main website to hold some sections of the sites. There will be many serverside generated links that will point to this...
2
by: craigkenisston | last post by:
Hi, I create a one day ticket in my authentication code like this : private void btnLogin_Click(object sender, System.EventArgs e) { string _userId = txtUserId.Text; string _password =...
4
by: radiax | last post by:
Is there a way to associate or bind a subdomain to a tcp sockets under .net framework (vb.net / c#). I know ip address can be used when using sockets, but the problem is the ip address is shared...
1
by: Hans Kesting | last post by:
Hi, Is it possible to share sessions between subdomains? Say: the user logs in at www.company.com, and is redirected to my.company.com. This is a different url for the same application. Can I...
4
by: Jim Carlock | last post by:
$_SERVER returns the root path for the subdomain, which is different than the root path for the primary domain. Is there a global variable to get the path for the root domain? What's the best...
1
by: Abandoned | last post by:
Hi.. I set cookie from www.domain.com but i'cant read this cookie from subdomain.domain.com How can i set cookie for all subdomains ? My set cookie code is: cookie =...
9
by: Josh | last post by:
I run a Joomla website and am familiar with php in some but not all aspects. Currently I am trying to find some solutions related to session handling. Am I correct in saying that "login" is kept...
3
by: bnashenas1984 | last post by:
Hi everyone I'v made a website which allows users to have their own subdomains Each user can have a blog in a unique subdomain Now I need to let my users register their own domain names and...
3
by: Jonathan Wood | last post by:
Perhaps someone who understand Web hosting can offer some insight into this. I have several sites hosted at http://www.crystaltech.com. There were highly recommended and seem pretty good. But...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.