我在我的脚本中使用以下代码来抓取我需要的源代码的一部分但是它会得到这个错误
解析错误:语法错误,意想不到的T_ENCAPSED_AND_WHITESPACE,期待')'在/home/cyberhos/public_html/CH/tes.php第151行
simple_html_dom.php已经在我的脚本中发出了
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>
您在编辑的这一行中缺少'
$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";
}
}
}