How can file_get_contents() and file_put_contents() functions be used to automate the process of converting dynamic PHP pages to static HTML pages?

To automate the process of converting dynamic PHP pages to static HTML pages, you can use the file_get_contents() function to retrieve the dynamic content of the PHP page and then use file_put_contents() function to write this content to a new HTML file.

<?php
// Retrieve the dynamic content of the PHP page
$content = file_get_contents('dynamic_page.php');

// Write the content to a new HTML file
file_put_contents('static_page.html', $content);
?>