从网页/网站中查找关键字

时间:2015-03-31 10:10:00

标签: php preg-match file-get-contents

我有能够从特定网址/网页中找到该字词的代码

$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获取关键字“沙发”及其相关细节,例如类型和费用

1 个答案:

答案 0 :(得分:0)

是的,它可能从网站获取数据但大多数网站由于垃圾邮件和安全问题而不允许直接访问。

  • 您可以使用Php库Ganon
  • 或者在网页中注入Javascript链接。
相关问题