I've been getting this error code whilst trying to get the A tags from a URL: "Fatal error: Uncaught Error: Call to a member function find() on string in (filename) Stack trace: #0 {main} thrown in (filename) line 9."
This is my code.
<?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>';
?>
I have seen 1-2 questions with the same error on StackOverflow, just none of them have solved my issue which is why I've resorted to asking myself.