我正在建一个网站,推荐其他好网站。PHP,获取网页内容文字
因此,我通过使用抓取系统收集了很多网站。
现在,我想通过使用PHP来区分网站是否有好词汇。
$page_content = file_get_contents($url);
$bad_word = 'damn';
if(strstr($page_content, $bad_word)):
$result = 'YES';
else:
$result = 'NO';
endif;
我的代码是这样的。
我使用Codeigniter并获取此消息。
An Error Was Encountered
Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.
它工作正常,某些网站,但它不适用于其他网站。
有没有其他的方式来检索网站的内容?
你需要给一些拒收工作例如去帮助别人找出原因。 – Tinyfool
听起来像是一种很慢的方式来做到这一点,如果你每次检查单词(并逐个检查)。 – nico
我希望您知道您的“抓取工具”最有可能将大多数新闻和社交网站标记为“不良”。 –