$_SERVER['HTTP_REFERER']

ma non è affidabile al 100%...