Get variables from URL

Discussion in 'PHP' started by clvezlys, Apr 30, 2007.

  1. #1
    Basically, what I would like to know how can I extract a word from url. A basic example would be like in http://dpFolks.youaremighty.com. I want to know how it extracts the part dpFolks. Any ideas?
     
    clvezlys, Apr 30, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    
    preg_match('/http:\/\/([^\.]+)/', $url, $subdomain);
    
    echo $subdomain[1];
    
    PHP:

    Untested, but should work.
     
    nico_swd, Apr 30, 2007 IP
    clvezlys likes this.