I wanted to make a site that extracts the word\words used in the subdomain, and places it on an image.

Does anyone know how I could go about geting the info from the subdomain... or is this even possible?

EX.

*domain: youreafag.com

*user types: john.youreafag.com

*an image comes up that extracted "john" and placed it on the image

I do not want to have something like: www.youreafag.com?name=john

Please help! 😉 Thanks

    Have a look here I think what you'd be looking for would be the REMOTE_HOST and then split it down on dots with $domain=explode('.',$SERVER['REMOTE_HOST']); I may well be wrong on this so have a play around. It's definitely one of the $SERVER variables though.

    HTH
    Rob

      Use regular expressions.

      $domain = $SERVER["SERVER_NAME"];
      preg_match("/([A-Za-z0-9
      ])./i", $domain, $aMatches);

      echo $matches[0];

      Something like that anyway.

      if the current domain is "subdomain.domain.com", then that should match "subdomain".

      Or maybe there's allready a php function for it? wouldn't surprise me, I forget half the functions that are available.

      cya
      -Adam 🙂

        Write a Reply...