Just use file_get_contents
It's a core php function that works on urls. No need for curl.
https://www.php.net/manual/en/function.file-get-contents.php
<?php
if($_SERVER["REQUEST_METHOD"] == "POST") {
//GET THE HTML SOURCE CODE
$html_source = file_get_contents($_POST["url"]);
// Display the HTML source code with syntax highlighting
echo "<pre><code class='language-html'>" . htmlspecialchars($html_source) . "</code></pre>";
}
?>
<form method="post">
<label for="url">Enter URL:</label><br>
<input type="text" id="url" name="url" size="50"><br><br>
<input type="submit" value="Load HTML Source">
</form>