Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Récupérer la racine du referer
<?php
function racine_referer()
{
if (!isset($_SERVER['HTTP_REFERER'])){
return false;
}else{
$parser_url = parse_url(trim($_SERVER['HTTP_REFERER']));
return trim($parser_url[host] ? $parser_url[host] : array_shift(explode('/', $parser_url[path], 2)));
}
}
//utilisation
echo racine_referer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment