我想解析多個html頁面的代碼到一個字符串,使得像一個緩衝區,並閱讀此字符串,以便找到一個特定的文本輸入,everthing是好的,唯一的問題,是我無法將頁面加載到字符串中並讀取之後。如何將多個html頁面解析爲字符串?
$url = 'http://www.test.com/';
$start = 0;
$end = 1120;
$counter = $start;
while ($counter <= $end) {
/*** a link to search - add the counter value and html to the end of url ***/
$link = "$url$counter.html";
/*** get the links ***/
$data = file_get_contents($link);
$data = $data.$data;
// echo $data;
$counter = $counter + 15;
}
有人能幫助我在這種情況下?
問候
說明什麼? –
你有沒有做任何調試? 'file_get_contents'的結果是什麼? –
爲什麼你正試圖從多個頁面解析DOM到一個字符串?像你想要解決什麼樣的問題?當然有更好的方法來做你想做的事情。 –