aeboi80 Posted April 19, 2010 Share Posted April 19, 2010 I need to do two things. I have a string called $domain which contains a domain name. What I need to do is know the domain name and also the domain extension. So for example lets let $domainName = mydomain.com I need to trim it to the . and store mydomain in $domain and then store com in $tld Make sense? I thought I had to explode $domainName somehow but I just can figure this out. Thanks Link to comment https://forums.phpfreaks.com/topic/198976-trim-string-to/ Share on other sites More sharing options...
aeboi80 Posted April 19, 2010 Author Share Posted April 19, 2010 UPDATE: Also, the domain name is not always going to be .com what if it was .us or .ws ? How can I account for the lack of knowledge of how many characters appear after the . ? Link to comment https://forums.phpfreaks.com/topic/198976-trim-string-to/#findComment-1044421 Share on other sites More sharing options...
Ken2k7 Posted April 19, 2010 Share Posted April 19, 2010 parse_url should do the job. Link to comment https://forums.phpfreaks.com/topic/198976-trim-string-to/#findComment-1044423 Share on other sites More sharing options...
salathe Posted April 19, 2010 Share Posted April 19, 2010 Do you need to cater for more than one 'extension': co.uk for example? Will there ever be any subdomains: www.example.com? Link to comment https://forums.phpfreaks.com/topic/198976-trim-string-to/#findComment-1044468 Share on other sites More sharing options...
Ken2k7 Posted April 28, 2010 Share Posted April 28, 2010 Can you have a subdomain that is www.www.domain.com? Link to comment https://forums.phpfreaks.com/topic/198976-trim-string-to/#findComment-1049906 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.