PHP-file_get_contents跳过样式和脚本


PHP - file_get_contents skip style and script

我正在尝试提取一个网站的html,

我正在使用file_get_contents($url)

当我运行CCD_ 2时,它需要花费太多时间来拉取主站的html,我可以跳过样式、脚本和图像吗?

我认为这样会花更少的时间来提取该网站的html。

尝试:

$file = file_get_contents($url);
$only_body = preg_replace("/.*<body[^>]*>|<'/body>.*/si", "", $file);