1

How do I find the content "Please enter a valid key again" using Simple HTML DOM Parser?

Example:

<script language="javascript">
     function Enable() {      
        alert('Please enter a valid key again');
     }
</script>

This don't seem to work:

<?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";
}
?>
4

1 に答える 1

4

これは、より簡単な方法で実行できます。

<?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");
?>
于 2011-06-30T23:50:06.660 に答える