IT.COM

Parse a URL in PHP to return domain - Repost

Spaceship Spaceship
Watch
Over the last 5 years, I've received at least two dozen requests for a copy of the DomainFind script I coded in 2004 on another thread. Unfortunately, it appears NamePros had deleted older attachments, thus the zip attachment to the original thread was not working.

I've since been concentrating on other things than PHP programming, but I recently managed to dig up a copy of the latest version of the DomainFind script I wrote before. For the benefit of the community and other guests searching Google, I am making it available again.

Note that there may be different techniques now to accomplish the same thing, but the underlying code still works well. You may want to compare with member "deadserious'" code that he posted at http://www.namepros.com/353616-post35.html to see which version better suits your needs.

=============
SCRIPT INFO
PHP:
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ---  FIND DOMAIN NAME (HOSTNAME) GIVEN ANY TYPE OF URL OR TLD EXTENSION (v3.01)  ---
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//                    --  VERSION 3.01 Final  --
**NOTE: The below comments may be removed in your script. Above must remain intact.
------------------
| Changes/Fixes  |
------------------
+ Added auto removal of 'www' if present
+ Added ANY TLD routine ... CountryCode TLDs work! ex> co.uk, any.tld.ext
+ Added subdomain function ... manual recognition
+ Integrated all routines in function... only end-user input is isolated
+ Fixed SERVER variables, in which "host" is undefined, only "path" array holds
+ Fixed case insenstivity mode
+ Improved Execution of Code via Regular Expressions
*/

=============
DOWNLOAD: [See attachment below]
=============

In case any suggestions, modifications or improvements are needed, please feel free to post here, and I'll see what I can do to improve the code.

Hope this helps!

Regards,
Anand
 
Last edited:
1
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Sdfdf

---------- Post added at 08:37 PM ---------- Previous post was at 08:36 PM ----------

YOUR SCRIPT IS GIVING ERROR...
Notice: Undefined index: host in C:\xampp\htdocs\123.php on line 56
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back