When I use $_SERVER['HTTP_ORIGIN']
.
echo $_SERVER['HTTP_ORIGIN'] ;
Return Notice: Undefined index: HTTP_ORIGIN in D:\xampp\htdocs\safe\test.php on line 12
What is Wrong?!
When I use $_SERVER['HTTP_ORIGIN']
.
echo $_SERVER['HTTP_ORIGIN'] ;
Return Notice: Undefined index: HTTP_ORIGIN in D:\xampp\htdocs\safe\test.php on line 12
What is Wrong?!
The Origin
header isn't sent by all browsers.
Depending what you're trying to do, another option is to use the Referer
header:
echo $_SERVER['HTTP_REFERER'];
By the way, note that request headers are ultimately controlled by the user, so can't be fully trusted.