0

我在我的脚本中使用以下代码来获取我需要的部分源代码,但它得到了这个错误

解析错误:语法错误,意外的 T_ENCAPSED_AND_WHITESPACE,在第 151 行的 /home/cyberhos/public_html/CH/tes.php 中期待 ')'

simple_html_dom.php 已在我的脚本 elswhere 中发布

        if (isset($_POST['mp'], $_POST['delim'], $_POST['submit'])) {
        $mps = preg_split('/\r\n|\r|\n/', $_POST['mp']);

        // Create an array to store results
        $result_data = array();

        // Iterate over requests
        foreach ($mps as $mp) {
            $mp = explode($_POST['delim'], $mp);

            // Store the account details in variables
            list($email, $password) = $mp;

            // Get HTML data
            $html_string = checkmail($email, $password);
            $html = str_get_html($html_string);
            $body = $html->find('div[id="welcome_text"]);
            // Prepare a reusable string
            $result_string = "Checked " . $email .  " : " . $password . " is ";

            // Append necessary word to it
            if ($html>welcome_text === "Welcome to Tesco.com. We hope that you enjoy your visit.") {
                $result_string .= "LIVE";
            } else {
                $result_string .= "DEAD";
            }

我该如何解决这个错误有什么办法可以解决这个错误,以便我的脚本正常工作

这是我想要得到的源代码的一部分

<div id="welcome_text" class="">
<div class="box">

Welcome to Tesco.com. We hope that you enjoy your visit.
<a id="ctl00_ctl00_lnkLogin" href="javascript:__doPostBack('ctl00$ctl00$lnkLogin','')">Log out</a>
</div>
4

1 回答 1

1

你错过'的这一行编辑的是

 $body = $html->find('div[id="welcome_text"]');

您编辑的代码

 if (isset($_POST['mp'], $_POST['delim'], $_POST['submit'])) {
    $mps = preg_split('/\r\n|\r|\n/', $_POST['mp']);

    // Create an array to store results
    $result_data = array();

    // Iterate over requests
    foreach ($mps as $mp) {
        $mp = explode($_POST['delim'], $mp);

        // Store the account details in variables
        list($email, $password) = $mp;

        // Get HTML data
        $html_string = checkmail($email, $password);
        $html = str_get_html($html_string);
        $body = $html->find('div[id="welcome_text"]');
        // Prepare a reusable string
        $result_string = "Checked " . $email .  " : " . $password . " is ";

        // Append necessary word to it
        if ($html>welcome_text === "Welcome to Tesco.com. We hope that you enjoy your visit.") {
            $result_string .= "LIVE";
        } else {
            $result_string .= "DEAD";
        }
    }
}
于 2013-04-29T09:42:52.737 回答