0

Possible Duplicate:
How to get redirecting url link with php from bit.ly

I am sending traffic through a bit.ly link to my webpage.

I want to keep track of what bit.ly link it was that the user came to my site with (they are pasting the URL directly into the browser).

Is there anyway that i can get the URL (bit.ly link) that was pasted into the browser?

Ive tried:

echo $_SERVER['HTTP_REFERER'];

But that comes up blank..

Bit.ly links are 301 redirects so it should be possible somehow to grab it?

Any ideas?

Community
  • 1
  • 1
Jacqueline
  • 481
  • 2
  • 11
  • 20
  • The duplicate requires me to know the bit.ly/link which i dont :/ – Jacqueline Dec 12 '12 at 05:27
  • So you have bit.ly redirecting to you and you want the referrer that bit.ly would have seen? If so, then the supposed duplicate isn't a duplicate at all and is sort of the opposite of what you're trying to do: you don't want to know where a bit.ly link points to, you want to know where it comes from. – mu is too short Dec 12 '12 at 08:56

2 Answers2

1

You could use GET variables to do the trick.

Create a bit.ly link that points at www.yourdomain.com/?ref=bitly

Then use $_GET['ref'] in PHP to determine where the user came from.

May not be exactly what you are after but it will work.

  • I would do this if i had not already had 3000 bit.ly links live :) I need something that can be implemented on those 3000 links – Jacqueline Dec 12 '12 at 05:23
0

Sadly the http_referrer header is not required and in some browsers (IE specifically) it is just not sent with the request. Unfortunately this leaves you with the situation of not having a reliable way to track the referring url.

You can find more information here

Kelly Copley
  • 2,990
  • 19
  • 25