![]() |
| Domain Name Sales | Domain Software | Calculate UK Domain Drop Dates | Domain Registration | NameDrive | Domain Parking | Subscribe to our Domains For Sale newsletter |
| | ||||||
| Home | Register | Rules | Membership Upgrade | Domains For Sale | Domain Name Escrow | Mark Forums Read | Domain Classified | Chat Room |
| Scripts and Coding PHP, MySQL, scripts |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
![]() | PHP eregi domain
Any simple way to dig out just the domain without hlq? www.test.co.uk Ive also noticed $_SERVER['SERVER_NAME'] sometimes contains WWW. that needs stripping. blar.domain.co.uk = domain www.domain.co.uk = domain domain.co.uk = domain
__________________ Banking Sort code database & Sort code lookup and verify & Sort codes info & Sort code Available UK domain lists - Garden patio heaters Last edited by purg; 17-02-2009 at 01:30:12 PM. |
| |
| | #2 (permalink) |
![]() |
what bit do you want specifically? Just the 'test' in www.test.co.uk ?
__________________ UK Web Design & Development Airport Car Parking | Business Help & Advice | Critical Illness Insurance | Smoothie Recipes | Baby Name Books |
| |
| | #3 (permalink) |
![]() |
Eregi for detecting domain names is crazy as http://www.i.am.adding.many.sub-domain.test.co.uk is a valid name, so it takes some fancy regex to detect all the varients, I wrote about 100 lines of code to do this and still had some name getting thru so I went with a quick and nasty snippet. PHP Code:
__________________ Browse: |
| |
| | #4 (permalink) |
![]() |
Have a look at http://www.acorndomains.co.uk/genera...tml#post162895 I posted a stack of code on my parking script, which I still havent finished or made look pretty :P
__________________ Browse: |
| |
| | #5 (permalink) |
![]() |
Whizz.... Correct Skinner.... thanks for the link but:- My draft looks similar to your snippet but caters and removes sub domain levels. Only failed style of domain would be two char hlq domains (xx.xx.CC or WS style of names) with one char subdomain. I dont own any so not a problem for my needs. PHP Code:
__________________ Banking Sort code database & Sort code lookup and verify & Sort codes info & Sort code Available UK domain lists - Garden patio heaters Last edited by purg; 17-02-2009 at 01:31:50 PM. |
| |
| | #6 (permalink) |
![]() |
Due to .ac, .com, .info, .travel, .museum, .whogizzafuck the scripts was all failing on full tests. My original 100 line function, used a multidimentional array, where I exploded the URL on a period, then tested the highest element of the array against tld[x], then tested tld[x][y] on highest -1, to see if that existed on the second level, if it was a positive then I accepted url+tld[x][y]+tld[x], else I assumed url+tld[x], then I performed a DNS look up to test it, where URL = part -3 of the exploded url. However it was a nightmare finding all the official subs to build the multi-dim and it slowed the script down doing look ups and stuff so I went all slasher movie and hacked it up
__________________ Browse: |
| |
| | #7 (permalink) | |
![]() |
Goodness me. Either I'm not understanding this right, or you are all handling this wrong The below code will take an array of domains in a variety of formats, and will get you just the domain element (i.e. no subdomains, no TLDs). Let me know how you get on: PHP Code: Quote:
__________________ UK Web Design & Development Airport Car Parking | Business Help & Advice | Critical Illness Insurance | Smoothie Recipes | Baby Name Books | |
| |
| | #8 (permalink) | |
![]() |
Whizz, we are talking about returning ONLY the domain.ext with no subdomains. Checking if its a valid domain is easy, but slicing the www. or del. or whatever else off the end of the start of a domain is no easy task. If you knew for a fact that you would only ever get www. you'd just reg replace, but on a parking script ideally you want wildcard sub domains but need a way to pull your database entry Quote:
Now because the .ext's can be between 2 and 7 chars long and between 1-2 sections (.com vs .co.uk), it makes separating them hard work. If you have a nice easy way I'd love to see it :P
__________________ Browse: | |
| |
| | #10 (permalink) |
![]() |
Also, again 'im no php expert' but can't you do this with explode? Get the domain explode it by "." If the last part of the returned array contains "uk" then your domain with extension is made up of the last 3 parts of the array If it doesn't contain "uk" the last two parts of the array are what you want Or maybe I'm making this up as I go along Grant |
| |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Domain Name Community | Replies | Last Post |
| Bounce.co.uk appeal decision | michaeltoth | Domain Name Disputes | 65 | 22-07-2006 04:14:14 AM |