Php 如何在没有任何错误的情况下获取html源代码?

Php 如何在没有任何错误的情况下获取html源代码?,php,html,Php,Html,我想得到一个网页的html源代码,但给出了一个错误!! 我将此代码用于give: <?php header('Content-Type: text/html; charset=utf-8'); $html = file_get_html("http://www.google.com/"); echo $html; 改为使用函数文件“获取内容”: 您应该这样做,注意:下载simple_html_dom类 如果您使用的是简单的html dom,请不要这样做。如果您想要

我想得到一个网页的html源代码,但给出了一个错误!! 我将此代码用于give:

<?php
    header('Content-Type: text/html; charset=utf-8');
    $html = file_get_html("http://www.google.com/");
    echo $html;
改为使用函数文件“获取内容”:


您应该这样做,注意:下载simple_html_dom类


如果您使用的是简单的html dom,请不要这样做。如果您想要整个页面的实际HTML,那么它是没有用的。充其量,它是为了从页面上获取一些内容,但即使这样,它也相当糟糕。
����i�[S$%ٲ�9������
<?php
include_once('simple_html_dom.php');
$html = file_get_html('http://www.google.co.in');
echo $html;
?>