79136556

Date: 2024-10-29 09:38:21
Score: 0.5
Natty:
Report link

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>
Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: dvicemuse