Php 从网页/网站查找关键字
我有可以从特定url/网页中找到单词的代码Php 从网页/网站查找关键字,php,preg-match,file-get-contents,Php,Preg Match,File Get Contents,我有可以从特定url/网页中找到单词的代码 $homepage = file_get_contents('http://www.example.com/furniture'); if (preg_match("/Sofa /i", "$homepage")) { echo "A match was found."; } else { echo "A match was not found."; } 我想知道的是,是否可以从整个网站www.example.com动态获取关键字“s
$homepage = file_get_contents('http://www.example.com/furniture');
if (preg_match("/Sofa /i", "$homepage")) {
echo "A match was found.";
} else {
echo "A match was not found.";
}
我想知道的是,是否可以从整个网站www.example.com动态获取关键字“sofa”及其相关详细信息,如类型和成本是的,可以从网站获取数据,但由于垃圾邮件和安全问题,大多数网站不允许直接访问
- 您可以使用Php库
- 或者在网页中插入Javascript链接