Finding Out Where a Script is Running

Discussion in 'PHP' started by Darkhodge, May 7, 2007.

  1. #1
    Hi,


    I will have a PHP script on a site that accesses a PHP script on another site. For example site A (e.g. http://www.siteA.com/grab.php) needs to get the RSS feed from site B (e.g. http://www.siteB.com/rss.php).

    Is there a way that I could code the page on siteB so it knows which page on what domain is accessing the file? I need this so I can store it in to a database...

    So for example if site A accesses the RSS page on site B, "http://www.siteA.com/grab.php" would be stored in a variable in rss.php?

    I hope that was clear enough....


    Thanks,

    Hodge :eek:
     
    Darkhodge, May 7, 2007 IP
  2. dp-user-1

    dp-user-1 Well-Known Member

    Messages:
    794
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #2
    $HTTP_REFERER?

    Maybe?
     
    dp-user-1, May 7, 2007 IP
  3. champ_rock

    champ_rock Peon

    Messages:
    3,349
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ya i can also think of storing the referrer information.. that will do the trick
     
    champ_rock, May 8, 2007 IP
  4. Darkhodge

    Darkhodge Well-Known Member

    Messages:
    2,111
    Likes Received:
    76
    Best Answers:
    1
    Trophy Points:
    185
    #4
    I used to use that but for some user agents it doesn't work:

    Is this the best option possible though?
     
    Darkhodge, May 8, 2007 IP
  5. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Unless you have control over the sites which grab the feed, there's not a lot you can do.

    At best, you could record the IP address and then at least you'd know which server the request came from but as for which domain let alone which page, you'd need the page to give you that information. (I.e. by forcing it to use /rss.php?from=http://siteA.com/grab.php)
     
    rodney88, May 8, 2007 IP