I did take such advise and all was going good till I tried a international
name

 

I use my url and get

 

Array

(

    [0] => http://www.davemaharaj.com

    [scheme] => http

    [1] => http

    [host] => www.davemaharaj.com

    [2] => www.davemaharaj.com

    [subdomain] => www

    [3] => www

    [domain] => davemaharaj.com

    [4] => davemaharaj.com

    [extension] => com

    [5] => com

)

 

But use a test url like http://southcreative.com.au/ <- notice the extension

 

(
    [0] => http://southcreative.com.au/
    [scheme] => http
    [1] => http
    [login] => 
    [2] => 
    [pass] => 
    [3] => 
    [host] => southcreative.com.au
    [4] => southcreative.com.au
    [subdomain] => southcreative
    [5] => southcreative
    [domain] => com.au (com.au is not the domain)
    [6] => com.au
    [extension] => au
    [7] => au
    [port] => 
    [8] => 
    [path] => /
    [9] => /
)

 I am guessing it is not possible to distinguish between the 2 since sub
domain could.have.an.unknown.limitless.number.of.subs 

 

How would a function know 

 

some.thing.com is a "some" subdomain only keep thing.com

 

just as it would not know  some.thing.com.au it thinks "some.thing.com" are
sub domains of "au" 

The only way to separate the string into separate parts is (.) and no way to
tell if it's a sub or domain.

 

 

 

 

From: Andrei Mita [mailto:[email protected]] 
Sent: September-14-10 2:19 PM
To: [email protected]
Subject: Re: Dealing with subdomains in URL

 

Someone suggested http://php.net/manual/en/function.parse-url.php Read the
User Contributed Notes and maybe you'll find something useful.

If not, you can always try manipulating the URL with the string functions I
have mentioned earlier.

For instance, you could remove everything from the URL after the first /

On Tue, Sep 14, 2010 at 7:38 PM, Dave Maharaj <[email protected]> wrote:

I have a url field, enter your website no big deal in my form.

 

So thru testing and tinkering I managed to end up with just the domain which
is what I want..so no matter what they enter with or without http or www or
even adding in subdomain I just get domain.extension perfect.

 

THEN INTERNATIONAL EXTENSIONS KILLED ME

 

I tried a site that ended in .com.au/ and it removes ".com" thinking it's a
subdomain. Ad then the users URL points to nothing since it needs the full
".com.au/"

 

So is there anyway around this? Is it either allow subdomins which I
strongly do not want or screw international domains? Or someone out there
has the answer?

 

Thanks.

 

Dave

 

 

Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
<mailto:cake-php%[email protected]>  For more options, visit
this group at http://groups.google.com/group/cake-php?hl=en

 

Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to