0

I'm looking for a way i can get the page that redirected to mine.

For example, if a user is on http://facebook.com and he clicks on a link that bring him to my page http://example.com, how do i get the url (http://facebook.com) for which such user came from.

PS: My english is not so good.

1 Answers1

0

In PHP you can use $_SERVER['HTTP_REFERER']

From PHP MANUAL: https://www.php.net/manual/en/reserved.variables.server.php The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

HTTP referer WIKI: https://en.wikipedia.org/wiki/HTTP_referer

dale landry
  • 7,831
  • 2
  • 16
  • 28