Php 使用简单的HTMLDOM解析器从Javascript中查找内容
如何使用简单的HTMLDOM解析器找到“请再次输入有效密钥”的内容 例如:Php 使用简单的HTMLDOM解析器从Javascript中查找内容,php,dom,simple-html-dom,php-parser,Php,Dom,Simple Html Dom,Php Parser,如何使用简单的HTMLDOM解析器找到“请再次输入有效密钥”的内容 例如: <script language="javascript"> function Enable() { alert('Please enter a valid key again'); } </script> 函数Enable(){ 警报(“请再次输入有效密钥”); } 这似乎不起作用: <?php include_once("simpl
<script language="javascript">
function Enable() {
alert('Please enter a valid key again');
}
</script>
函数Enable(){
警报(“请再次输入有效密钥”);
}
这似乎不起作用:
<?php
include_once("simple_html_dom.php");
$html = file_get_html("incorrect.html");
$ret = $html->find("Please enter a valid key again", 0);
if ($ret) {
echo "found";
} else {
echo "not found";
}
?>
您可以用一种更简单的方法来完成:
<?php
include_once("simple_html_dom.php");
$html = file_get_html('incorrect.html');
(strstr($html,'Please enter a valid key again')) ? print("found") : print("not found");
?>
您可以用一种更简单的方法来完成:
<?php
include_once("simple_html_dom.php");
$html = file_get_html('incorrect.html');
(strstr($html,'Please enter a valid key again')) ? print("found") : print("not found");
?>
我不使用它,但它不是更简单更快,因为它使用编译代码来使用DOMDocument吗?然后您就可以执行$doc->getElementsByTagName(“脚本”)?或者因为你似乎只是在做字符串搜索?使用preg_match或strpos()在html字符串数据中搜索它?我不使用它,但它不是更简单更快,因为它使用编译代码来使用DOMDocument吗?然后您就可以执行$doc->getElementsByTagName(“脚本”)?或者因为你似乎只是在做字符串搜索?使用preg_match或strpos()在html字符串数据中搜索它?