Tuesday 3 June 2014

How to get full referrer url in php 0

To get referrer url, we are going to use $_SERVER variable called HTTP_REFERER.

In some cases we need to check, this page redirected from where? To fill up that "where" we should use  $_SERVER[HTTP_REFERER].

NOTE:
  • If users use a bookmark or directly visit your site by manually typing in the URL, HTTP_REFERER will be empty.
  • If the users are posting to your page programatically (CURL) then they're not obliged to set the HTTP_REFERER as well.

So, to get full referrer URL in your PHP page, we need to use,
echo $_SERVER[HTTP_REFERER];
Have any doubt, feel free to comment here!

Related Post : How to get current full URL in PHP

0 comments:

Post a Comment