Sub Domain

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kishor7410
    New Member
    • Mar 2007
    • 4

    #1

    Sub Domain

    I have an URL like: www.mail.yahoo. com.
    But I want to show this URL: www.username.ma il.yahoo.com
  • devsusen
    New Member
    • Feb 2007
    • 136

    #2
    Originally posted by kishor7410
    I have an URL like: www.mail.yahoo. com.
    But I want to show this URL: www.username.ma il.yahoo.com
    should it be username.mail.y ahoo.com ?

    Comment

    • kishor7410
      New Member
      • Mar 2007
      • 4

      #3
      Originally posted by devsusen
      should it be username.mail.y ahoo.com ?

      Yes. What can I do now. Plz help.

      Kishor Kumar

      Comment

      • yumi ice
        New Member
        • Apr 2007
        • 2

        #4
        Originally posted by kishor7410
        Yes. What can I do now. Plz help.

        Kishor Kumar
        Hi,
        maybe you can try this (extracted from http://www.php.net/manual/en/function.preg-match.php)

        <?php
        // get host name from URL
        preg_match('@^( ?:http://)?([^/]+)@i',
        "http://www.php.net/index.html", $matches);
        $host = $matches[1];

        // get last two segments of host name
        preg_match('/[^.]+\.[^.]+$/', $host, $matches);
        echo "domain name is: {$matches[0]}\n";
        ?>

        The above example will output:
        domain name is: php.net

        Comment

        Working...