抓取一个网站
如何做...
public function getContent($url)
{
if (!$this->content) {
if (stripos($url, 'http') !== 0) {
$url = 'http://' . $url;
}
$this->content = new DOMDocument('1.0', 'utf-8');
$this->content->preserveWhiteSpace = FALSE;
// @ used to suppress warnings generated from // improperly configured web pages
@$this->content->loadHTMLFile($url);
}
return $this->content;
}如何运行...

参考
最后更新于