I think you mean that you want to access the "Origin" header in the request headers (as opposed to setting it in the response headers).
For this, the easiest way is to access the built-in getallheaders () function, which is an alias for apache_request_headers () - NB it is assumed that you are using php as a module.
This returns an array, so the Origin header should be accessible as follows:
$request_headers = getallheaders(); $origin = $request_headers['Origin'];
If you use php through something like fastcgi, then I believe that it will be available in the environment - usually with a capital letter and with the prefix "HTTP_", so it should be $_SERVER['HTTP_ORIGIN'] .
Hope this helps someone else find this :)
source share