2013-04-29 32 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