【问题标题】:curl php script always showing failed result when checkingcurl php脚本在检查时总是显示失败的结果
【发布时间】:2013-04-21 03:14:36
【问题描述】:

您好,我正在使用以下代码检查指定文本的 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) "(省略对象值)" ["ownerDocument"]=> string(22) "(省略对象值)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string( 5) "title" ["baseURI"]=> NULL ["textContent"]=> string(9) "Tesco.com" } NULL

【问题讨论】:

  • 这是我在这里看到的第一篇没有删掉“你好”的帖子
  • 你能帮忙吗,而不是仅仅评论一些无用的东西
  • 这是等待发生的 XSS 攻击。确保您使用 htmlspecialchars() 转义 HTML 的任意数据。
  • 布拉德我不懂

标签: php dom curl


【解决方案1】:

为什么它看起来像是某种蛮力脚本?无论如何,我想问题在于 $title-main 未声明。

if($title-main == "Sorry, but we couldn't sign you in"){

你应该这样做:

if($title == "Sorry, but we couldn't sign you in"){

【讨论】:

  • 我改变了它,但仍然只是成功而不是失败的错误登录
  • if 之前尝试var_dump($title)。也许它会揭示一些东西。
  • 只是导致此错误解析错误:语法错误,第 33 行出现意外的 T_IF
  • 查看:pastebin.com/NY9sapiM更新链接)。我猜你忘记了分号。
  • 我得到这个字符串(9) "Tesco.com" 成功 - 电子邮件:email@domain.com - 密码:密码
猜你喜欢
  • 1970-01-01
  • 2014-06-19
  • 1970-01-01
  • 2023-03-17
  • 2014-09-21
  • 2016-03-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多