There's $_SERVER['HTTP_REFERER'], but that relies upon the user agent to transmit it correctly and as such should be avoided for any serious purpose.