No announcement yet.

Using HTTP Referer

  • Filter
  • Time
  • Show
Clear All
new posts

  • Using HTTP Referer

    Been wondering for a while if there is such thing as a page http referer?

    For example,$_SERVER[HTTP_REFERER]

    This how ever will be like:

    I want it so that the referer directs you from the last folder/page on the URL. Sorry if I'm not clear

  • #2
    If you're using php, for a list of server and environment variables on your server, copy the line below into a blank .php page on your site

    <?php phpinfo() ?>

    Now call it up in your browser from a link on another page (if you go to it direct you won't get any of the referer stuff!)

    That shows you what's available.


    • #3
      Thanks for your help


      • #4
        Originally posted by karimali831 View Post
        Thanks for your help
        Be careful not to rely too much on what comes from the browser.

        Another way of looking at the server variables is to do this
        foreach ($_SERVER as $key=>$val){
        echo "Key:$key Value:$val<br>";
        However, looking at your original query, it's possible you may have to do a bit of processing to get the information you want.
        Last edited by black-dog; 22-04-09, 08:43 PM.
        black-dog Web stuff Band


        • #5
          Nice one :p

          Thanks again.


          • #6
            Hi !

            I feel it can be useful to use the HTTP_REFERER variable for logging etc purposes using the $_SERVER['HTTP_REFERER'] superglobal variable. However it is important to know it's not always set so if you program with notices on then you'll need to allow for this in your code. The above examples show one way of doing this.
            Signature has been removed, please do not advertise websites in your signature.