RE: [PHP] Parse domain from URL

2007-06-08 Thread Brad Fuller
Tijnema wrote: > On 6/7/07, Brad Fuller <[EMAIL PROTECTED]> wrote: >> Robin Vickery wrote: >>> In that case you can't do it just by parsing alone, you need to use >>> DNS. >>> >>> >> function get_domain ($hostname) { >>> dns_get_record($hostname, DNS_A, $authns, $addt); return >>> $authns[0][

Re: [PHP] Parse domain from URL

2007-06-07 Thread Tijnema
On 6/7/07, Brad Fuller <[EMAIL PROTECTED]> wrote: Robin Vickery wrote: > In that case you can't do it just by parsing alone, you need to use > DNS. > > function get_domain ($hostname) { > dns_get_record($hostname, DNS_A, $authns, $addt); return > $authns[0]['host']; } > > print get_domain("w

RE: [PHP] Parse domain from URL

2007-06-07 Thread Brad Fuller
Robin Vickery wrote: > In that case you can't do it just by parsing alone, you need to use > DNS. > > function get_domain ($hostname) { > dns_get_record($hostname, DNS_A, $authns, $addt); return > $authns[0]['host']; } > > print get_domain("www.google.com") . "\n"; print > get_domain("googl

Re: [PHP] Parse domain from URL

2007-06-07 Thread Daniel Brown
On 6/7/07, Robin Vickery <[EMAIL PROTECTED]> wrote: On 06/06/07, Brad Fuller <[EMAIL PROTECTED]> wrote: > Daniel Brown wrote: > > On 6/6/07, Brad Fuller <[EMAIL PROTECTED]> wrote: > >> > >> I need to strip out a domain name from a URL, and ignore subdomains > >> (like www) > >> > >> I can use par

Re: [PHP] Parse domain from URL

2007-06-07 Thread Robin Vickery
On 06/06/07, Brad Fuller <[EMAIL PROTECTED]> wrote: Daniel Brown wrote: > On 6/6/07, Brad Fuller <[EMAIL PROTECTED]> wrote: >> >> I need to strip out a domain name from a URL, and ignore subdomains >> (like www) >> >> I can use parse_url to get the hostname. And my first thought was to >> take th

RE: [PHP] Parse domain from URL

2007-06-06 Thread Stefan Wixfort
> From: Brad Fuller [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 06, 2007 5:44 PM > Subject: [PHP] Parse domain from URL > > Hey guys, > > I'm faced with an interesting problem, and wondering if there's an easy > solution. > > I need to strip

Re[2]: [PHP] Parse domain from URL

2007-06-06 Thread Richard Davey
Hi Brad, Wednesday, June 6, 2007, 5:04:41 PM, you wrote: > Yes, that's basically what my code already does. > The problem is that what if the url is "http://yahoo.co.uk/"; (note the lack > of a subdomain) > Your script thinks that the domain is "co.uk". Just like my existing code > does. > So

RE: [PHP] Parse domain from URL

2007-06-06 Thread Brad Fuller
Daniel Brown wrote: > On 6/6/07, Brad Fuller <[EMAIL PROTECTED]> wrote: >> Hey guys, >> >> I'm faced with an interesting problem, and wondering if there's an >> easy solution. >> >> I need to strip out a domain name from a URL, and ignore subdomains >> (like www) >> >> I can use parse_url to ge

Re: [PHP] Parse domain from URL

2007-06-06 Thread Daniel Brown
On 6/6/07, Brad Fuller <[EMAIL PROTECTED]> wrote: Hey guys, I'm faced with an interesting problem, and wondering if there's an easy solution. I need to strip out a domain name from a URL, and ignore subdomains (like www) I can use parse_url to get the hostname. And my first thought was to take

Re: [PHP] Parse domain from URL

2007-06-06 Thread Robert Cummings
On Wed, 2007-06-06 at 11:43 -0400, Brad Fuller wrote: > Hey guys, > > I'm faced with an interesting problem, and wondering if there's an easy > solution. > > I need to strip out a domain name from a URL, and ignore subdomains (like > www) > > I can use parse_url to get the hostname. And my first

[PHP] Parse domain from URL

2007-06-06 Thread Brad Fuller
Hey guys, I'm faced with an interesting problem, and wondering if there's an easy solution. I need to strip out a domain name from a URL, and ignore subdomains (like www) I can use parse_url to get the hostname. And my first thought was to take the last 2 segments of the hostname to get the doma