Using the function below you would be able to get the HTML code of any webpage.
Syntax
1
2
3
4
5
|
<?php
$url = "http://blog.koonk.com";
$source = display_sourcecode($url);
echo $source;
?>
|
1
2
3
4
5
6
7
8
9
|
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";
}
}
|
1
2
3
4
5
|
<?php
$url = "http://blog.koonk.com";
$source = display_sourcecode($url);
echo $source;
?>
|
Hello Friends! I am Ramana a part time blogger from Hyderabad.
0 comments:
Post a Comment