Thursday , November 7 2024

GET THE SOURCE CODE OF A WEBPAGE

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;
?>

About admin

Check Also

Convert Text To Image

You can convert text to image by using this php code. You then download the image …

Leave a Reply