I want to track where exactly is click from youtube video. U have tried with this code. But its return only "www.youtube.com/". I want to print this "https://www.youtube.com/watch?v=_bnur3gHJ0s"
<?
$whr = $_SERVER['HTTP_REFERER'];
print_r($whr);
?>
I want to track where exactly is click from youtube video. U have tried with this code. But its return only "www.youtube.com/". I want to print this "https://www.youtube.com/watch?v=_bnur3gHJ0s"
<?
$whr = $_SERVER['HTTP_REFERER'];
print_r($whr);
?>
Because of HTTPS, you dont (always) get a referer. You could check with print_r($_SERVER)
if there is something else, but don't rely on it too much.
A better solution would be to add a referer as get parameter, eg:
- example.com/somepage?ref=youtube_description
- example.com/somepage?ref=video&video=12345
Regex is probably your best method of choice. There's a post here that should benefit you.