SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Jul 2004
    Location
    Brooklyn, NY
    Posts
    316
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Very quick question, server referrer

    What PHP function can I use to pull as much information as possible about the referring website?

  2. #2
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,449
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    What kind of information are you looking for?

  3. #3
    SitePoint Addict
    Join Date
    Jul 2004
    Location
    Brooklyn, NY
    Posts
    316
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    referring url, referring ip address, server information...

  4. #4
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    var_dump($_SERVER); 
    That will show you what's available to you.

  5. #5
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just $_SERVER['HTTP_REFERER'], which may or may not even be defined. Essentially, I think you can only obtain the URL of the referring web site. You can get the IP if you extract the domain and use gethostbyname(). As for the other information I don't think you can really do that. Well, it depends on what information about the server you want to retrieve.
    Laudetur Iesus Christus!
    Christ's Little Flock
    Jesus is the Good Shepherd

  6. #6
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,561
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by markl999
    PHP Code:
    var_dump($_SERVER); 
    That will show you what's available to you.
    But that will show information about the server from which current page is being fetched. One information you can retrieve about the referrer is itís URL which you do through $_SERVER['HTTP_REFERER'] variable . You can process this information to get the IP address.
    I havenít done this before but I suppose you can get additional bit of information about sending it a request and then processing response headers.

  7. #7
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But that will show information about the server from which current page is being fetched.
    That's part of what it will show, but it will also show you what other client or referer information is available to you, one of which you mentioned, the HTTP_REFERER


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •