Email
Share

We Rock Your Web Forum » Web Programming

How to get domain name with php?

(3 posts)
  1. Woofus

    member
    Joined: Sep '09
    Posts: 32

    I'm trying to use php to save the current page URL in a variable, but I can't remember what the code is. Anyone?

    Posted 9 months ago #

  2. Posted 9 months ago
  3. Web Rocker

    admin
    Joined: Jun '11
    Posts: 26

    $domain = $_SERVER['HTTP_HOST'];

    Posted 9 months ago #
  4. Anonymous



    To request only the part after the domain (ie. for example.com/page-name, only "page-name"), use:
    $_REQUEST['q']

    Posted 9 months ago #

RSS feed for this topic

Reply

(required)

Allowed markup: BBcode blockquote code em strong ul ol li font strike center u hr.
You can also put code in between backtick ( ` ) characters.