What are the potential security risks associated with enabling the HTTP Wrapper in PHP for URL inclusion?

Enabling the HTTP Wrapper in PHP for URL inclusion can pose security risks such as remote code execution and exposing sensitive information. To mitigate these risks, it is recommended to validate and sanitize user input before using it in the include statement.

$url = filter_input(INPUT_GET, 'url', FILTER_VALIDATE_URL);
if ($url) {
    include($url);
} else {
    echo "Invalid URL provided.";
}