Using the function below you would be able to get the HTML code of any webpage.
function display_sourcecode($url)
{
$lines = file($url);
$output = “”;
foreach ($lines as $line_num => $line) {
// loop thru each line and prepend line numbers
$output.= “Line #<b>{$line_num}</b> : ” . htmlspecialchars($line) . “<br>\n”;
}
}
Syntax:
<?php
$url = “https://w2class.com”;
$source = display_sourcecode($url);
echo $source;
?>