Skip to main content

PHP Superglobals

What is PHP Superglobals - described here

Examples

How to get value of $_GET['some_key']

query {
some_get_request_parameter: superglobal_variable(variable: "GET", key: "some_key")
}

How to get value of $_GET['some_key'] with fallback

query {
some_get_request_parameter: superglobal_variable(variable: "GET", key: "some_key", fallback: "fallback_value")
}

How to get value of $_COOKIE['some_key']

query {
some_cookie_parameter: superglobal_variable(variable: "COOKIE", key: "some_key")
}

How to get value of $_COOKIE['some_key'] with fallback

query {
some_cookie_parameter: superglobal_variable(variable: "COOKIE", key: "some_key", fallback: "fallback_value")
}

How to get value of $_SERVER['HTTP_HOST']

query {
current_host: superglobal_variable(variable: "SERVER", key: "HTTP_HOST")
}