通过PHP检索网页内容的最简单方法是什么?

MrG*_*les 0 php

我想写一个函数来检索网页的内容,所以它的工作方式如下:

$url = "example.com";
$pageContent = RetrievePageContent($url);
Run Code Online (Sandbox Code Playgroud)

最简单的方法是什么?

在此先感谢您的帮助!

Mic*_*odd 6

$pageContent = file_get_contents($url);
Run Code Online (Sandbox Code Playgroud)

从: file_get_contents