我得到一个网页使用file_get_contents();
:
$file = file_get_contents('http://example.com');
如何检查网页是否包含文字"hello"或"bye"
$file = file_get_contents('http://example.com');
$exists = (strpos($file, 'hello') !== false) || (strpos($file, 'bye') !== false);
if ($exists !== false) {
print 'Found';
}
$file = file_get_contents('http://example.com');
if (strpos($file, 'hello') !== false)
{
echo "Exist..";
}