2

I tried using the same code that I have for a platform that does not use laravel but it gives me an error: Undefined index: HTTP_REFERER

$referrer = $_SERVER['HTTP_REFERER'];

if($referrer === 'http://example.example.info/prueba/')
{
 //continue
}

1 Answers1

3

You can get HTTP_REFERER in laravel with Request::server();

Request::server('HTTP_REFERER')

Refer : https://laravel.com/api/5.0/Illuminate/Http/Request.html#method_server

Dhaval Baldha
  • 376
  • 1
  • 8
  • I am trying to use `Request::server('HTTP_REFERER')` but only receives null. I need that if a user comes from a specific URL I can access the web and see my content – Cristian Salinas Dec 04 '19 at 10:05
  • I treid it and it's giving me url. `public function index(Request $request) { echo $request->server('HTTP_REFERER'); }` – Dhaval Baldha Dec 04 '19 at 10:17