简单PHP搜索引擎源代码,需要开启PHP的cURL扩展。功能:对某一网址进行检索,获取网站基本信
息,同时提取网站的所有连接。
class Engine{
private $_url = ''; //URL地址
private $_sites = ''; //页面信息
public function __construct($url){
$this->_url = $url;
}
//启动引擎
public function start(){
//$content = $this->socketOpen($this->_url);
$content = $this->getContent($this->_url);
$this->_sites['url'] = $this->_url;
$this->_sites['meta'] = $this->getMeta($content);
$this->_sites['title'] = $this->getTitle($content);
//$this->_sites['detail'] = $this->getDetail($content);
$this->_sites['links'] = $this->getLinks($content);
}
//获取meta内容
public function getMeta($conte