2013-04-29 97 views
0

我用我CRIPT下面的代码获取源代码的一部分,我需要 但得到这个错误简单的HTML DOM的PHP卷曲的错误不能抢文本,我需要

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ')' in /home/cyberhos/public_html/CH/tes.php on line 151

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

我怎样才能解决这个错误,有没有什么办法让我的脚本工作正常

继承人部O,我可以解决这个错误˚F源代码,我试图让

<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> 
+0

单引号'''缺少近线' $ body = ...'。您可以通过检查上面发布的代码中的颜色差异来清楚地了解这一点。 – Rikesh 2013-04-29 09:42:11

+0

你可以做一个编辑,所以我可以看到你的意思:) – 2013-04-29 09:42:40

+0

第17行的错字:'$ body = $ html-> find('div [id =“welcome_text”]''');' – 5ervant 2013-04-29 09:51:17

回答

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"; 
     } 
    } 
} 
+0

邪恶的该错误修复,但它仍然没有做我需要大声笑 – 2013-04-29 09:47:04

+0

感谢兄弟我会尽快接受答案的问题是它没有提取我想要的:/ – 2013-04-29 09:50:53

+0

我无法测试,因为你使用某种功能,我有没有在我的系统像'str_get_html'检查这个函数的输出它帮助你找到问题 – 2013-04-29 09:52:42