以下代码尝试通过class查找div不适用于google搜索结果,我也尝试过<< id >>。include('simple_html_dom.php');
$dom = file_get_html("https://www.google.com/search?q=best+mug");
$all_divs = $dom->find("div[class='g']");
foreach ($all_divs as $div) {
echo $div->plaintext;
}
以下代码尝试按类查找div,但不适用于google搜索结果,我也尝试过使用id。 include('simple_html_dom.php'); $ dom = file_get_html(“ https://www.google.com / ...