Forum Moderators: coopster

Message Too Old, No Replies

stripping chars if exist

         

adammc

9:03 pm on Jun 1, 2007 (gmt 0)

10+ Year Member



Hi folks,

Im using <?php echo $_SERVER['HTTP_HOST'];?> to get the users domain name for use in a form.

The problem is I only want to get their domain and not the www.

If they use 'www.' to get to the form then 'HTTP_HOST' contains a www.

How can I check to see if it exists and strip is away?

adammc

10:31 pm on Jun 1, 2007 (gmt 0)

10+ Year Member



i got it sorted using:

$str = preg_replace('/^www\./','',$_SERVER['HTTP_HOST']);