Skip to content
Advertisement

Getting Country / City data from google-app-engine

I am trying to access 2 headers on google app engine

X-AppEngine-Country

and

X-AppEngine-City

what i was trying to do is to useing $_REQUEST for example :

$_REQUEST["X-AppEngine-Country"]

$_REQUEST["X-AppEngine-City"]

and still not getting any data .

how can i access this headers ?

should i change values on the yaml file?

important : i am using php on google app engine

Advertisement

Answer

You should use $_SERVER["HTTP_X_APPENGINE_COUNTRY"] and $_SERVER["HTTP_X_APPENGINE_CITY"] instead.

See https://cloud.google.com/appengine/docs/standard/php7/reference/request-response-headers#app_engine-specific_headers for additional fields.

The specific $_SERVER additions are listed here https://cloud.google.com/appengine/docs/standard/php7/runtime#special_server_keys

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement