可以获取任意 Web 页面HTML 代码的PHP函数

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

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";
}
}

用法:

<?php
$url = "http://www.open-open.com";
$source = display_sourcecode($url);
echo $source;
?>