Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP HTTP Referrer

Tags:

post

php

referrer

I have a page which accepts POSTs from a remote site. I would like to detect the domain that these POSTs are coming from. I realize that it can be spoofed but it is better than nothing. I have tried accessing the HTTP_REFERER variable but it just returns null.

The page accepts POSTs from sources like PayPal (instant payment notifications) and other payment gateways.

How can I get the referring call?

like image 310
aaronfarr Avatar asked Mar 15 '11 03:03

aaronfarr


2 Answers

You spelled Referer correctly. It should be:

$_SERVER['HTTP_REFERER']
like image 118
Matthew Flaschen Avatar answered Oct 01 '22 16:10

Matthew Flaschen


$_SERVER['HTTP_REFERER'] 

with a single R, try var_dump($_SERVER) for more info.

like image 41
AbiusX Avatar answered Oct 01 '22 14:10

AbiusX