Display source code of any webpage

Submitted by:Jhon Brain

Date added:30 January, 2014

Category:PHP

How to display the source code of any webpage. you can use below example code

Tags: display source code , webpage source code

Code Snippet:

<?php // display source code
$lines = file('http://google.com/');
foreach ($lines as $line_num => $line) {
// loop thru each line and prepend line numbers
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "
\n";
}
 
 

Comments