body -> container -> mainContent -> content -> .vol -> ul -> li
的 href 路徑 (紅框部份)
include('./simple_html_dom.php'); $books = array(); $html = file_get_html($TARGET_PAGE); $html = $html->getElementById('content'); foreach ($html->find('div.vol') as $ul) { foreach ($ul->find('li') as $li) { $bookUrl = HOST_NAME.$li->children(0)->href; array_push($books, $bookUrl); } }
cf :
part2 : http://trully622.blogspot.tw/2013/03/code-php-simple-html-dom-parser-part2.html
回覆刪除