Php 努力解决“问题”;未捕获错误:调用成员函数find();

Php 努力解决“问题”;未捕获错误:调用成员函数find();,php,simple-html-dom,Php,Simple Html Dom,我在尝试从URL获取A标记时收到了此错误代码:“致命错误:未捕获错误:调用(文件名)堆栈跟踪中字符串上的成员函数find():#0{main}抛出(文件名)第9行。” 这是我的密码 <?php // Include the library include('simple_html_dom.php'); // Retrieve the DOM from a given URL $html = file_get_contents('https://www.google.com'); //

我在尝试从URL获取A标记时收到了此错误代码:“致命错误:未捕获错误:调用(文件名)堆栈跟踪中字符串上的成员函数find():#0{main}抛出(文件名)第9行。”

这是我的密码

<?php
// Include the library
include('simple_html_dom.php');

// Retrieve the DOM from a given URL
$html = file_get_contents('https://www.google.com');

// Find all "A" tags and print their HREFs
foreach($html->find('a') as $e);

echo $e->href . '<br>';
?>


我在StackOverflow上看到过1-2个同样错误的问题,只是没有一个解决了我的问题,这就是为什么我求助于自问。

文件获取内容应该是
文件获取html
@barmar,谢谢你的回答。当我执行此操作时,会出现以下三个错误:警告:file_get_contents():流不支持在第76行的(myfile)中查找——警告:file_get_contents():在第76行的(simple_html_dom.php文件)中的流中查找-1失败——致命错误:未捕获错误:调用(myfile)中布尔值的成员函数find()堆栈跟踪:#0{main}在第9行(myfile)中抛出,请参见