What are some best practices for securely including external PHP scripts in a webpage?

When including external PHP scripts in a webpage, it is important to ensure that the scripts are secure to prevent any vulnerabilities. One best practice is to use the `include_once` or `require_once` functions instead of `include` or `require` to prevent the same script from being included multiple times. Additionally, always validate and sanitize any user input before including it in the script to prevent malicious code injection.

<?php
// Include external PHP script securely
$external_script = 'external_script.php';

if (file_exists($external_script)) {
    include_once $external_script;
} else {
    echo "External script not found.";
}
?>