What are the pitfalls of using iframes to include web pages in PHP, and how can they be avoided?

Using iframes to include web pages in PHP can lead to security vulnerabilities such as clickjacking and cross-site scripting attacks. To avoid these pitfalls, it is recommended to use PHP's include or require functions to directly include the contents of the external web page.

<?php
include 'external_page.php';
?>