# PHP

There are multiple ways how to whitelist your GoodAccess IP in PHP.\
Below is an example of a basic whitelisting function. For more advanced setup, please refer to the following [**documentation**](https://www.php.net/manual/en/reserved.variables.server.php).

```php
function isAllowed($ip){
    $whitelist = array(‘111.111.111.111’, ‘112.112.112.112’);    // If the ip is matched, return true
    if(in_array($ip, $whitelist)) {
        return true;
    }    return false;
}
```

Using the whitelisting function for access control.

```php
if (! isAllowed($_SERVER[‘REMOTE_ADDR’])) {
    exit;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.goodaccess.com/configuration-guides/ip-whitelisting/php.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
