I would like to parse an HTML file in order to extract some information.
My code is:
$url = 'http://localhost/myFiles/';
$response = file_get_contents($url);
$html = new simple_html_dom();
$html->load_file($response);
if (!empty($html)) {
foreach($html->find('tr td a') as $a) {
echo $a->href.", ";
}
}
As I can see, $response is a string and not an html file. That's why I get error message: Call to a member function find() on a non-object.
json_decode($response, true);It should create a json array of your string.