FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Help for REgular Expression!





AOP Web Development
Hello, to all php guru out there. heheheh

i just like to asked for your help regarding parsing a domain i hope that you can help me with this..

i will give some of the examples that need to output on right way..


1. http://www.example.com/index.php

2. http://www.subdomain.example.com/index.php?cmd=1&page=2.......

3. www.example.com

4. subodomain.list1.example.com

5. www.example.com.au - needs to ouput example.com.au


All Output: example.com


Note that i need any tld i'm not specifiying one TLD or domain extensions.. and other thing is there are also 2 dot in tld like co.uk, com.ph and etc.... so i only need to get is the domain name..


I hope you can help me with this..

thanks Smile
Ranfaroth
How do you make the difference between example.com.au and au.example.com ?
AOP Web Development
what do you mean?????????? hehehheh i guess

au.example.com - is subdomain right?

and example.com.au - is something like an extension of a tld representing countries..

is that what you mean?????

anyway i don't matter with that i just only need the output
MrBlueSky
I think what he means is this: when you process www.example.com.au, how do you know if it has to become example.com.au, or com.au? For a human this is easy: it should be the first. But that's because we know .au is a TLD which has sub-TLD's. A script doesn't know that.

To solve this, you'll have to provide a list of all possible TLD's to the script.

Another example, to make it clear:

www.message.msn.cx

Should the outcome be "msn.cx" or "message.msn.cx"?
AOP Web Development
yeah your right, im don't care regarding the tlds or what ever tlds i know that are a lot of tld and new tlds comes out... most specially with this are every country i guess have sub tlds. but don't know sure about it..


let say you have

www.example.gov.uk - example.gov.uk
www.example.co.uk - example.co.uk

http://subdomain2.subdomain1.example.com.au - example.com.au
http://subdomain.domain.gov.au - domain.gov.au
http://subdomain.list.au - list.au


here is the example of some tld but im not specifying that that are the only valid.. but what want is something like that more flexible to use
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.