用于在网页上搜索单词的PHP脚本

用于在网页上搜索单词的PHP脚本,php,html,parsing,Php,Html,Parsing,有人能告诉我如何改变以下PHP脚本说“发现”如果该网站有“站起来”一词,如果它没有说“没有发现” <?php $data = file_get_contents('http://www.stutteringjohnsmmith.com/#/0'); $regex = '/Page 1 of (.+?) results/'; preg_match($regex,$data,$match); var_dump($match); echo $match[1]; ?> 笑?您正在使用

有人能告诉我如何改变以下PHP脚本说“发现”如果该网站有“站起来”一词,如果它没有说“没有发现”

<?php
$data = file_get_contents('http://www.stutteringjohnsmmith.com/#/0');
$regex = '/Page 1 of (.+?) results/';
preg_match($regex,$data,$match);
var_dump($match);
echo $match[1];
?>


笑?


您正在使用wordpress域(http://stutteringjohnsmith.wordpress.com/)

以下工作将起作用:

$data = file_get_contents('http://stutteringjohnsmith.wordpress.com/');
$regex = '/standup/';    

if (preg_match($regex, $data)) {
    echo "found";
} else {
    echo "not found";
}
<?php
$text = file_get_contents('http://www.stutteringjohnsmith.com/#/0');
echo (stristr ($text, 'standup')) ? 'found' : 'not found';
?>
$data = file_get_contents('http://stutteringjohnsmith.wordpress.com/');
$regex = '/standup/';    

if (preg_match($regex, $data)) {
    echo "found";
} else {
    echo "not found";
}