Hi PHP Experts
I am using the 'PHP simple HTML DOM Parser'. It works OK for me when a page has a file extension .php. So for example a file called test-status.php with the code below works OK where the same file renamed test-status.html will not work. There is no error, just blank.
Now here's the funny part. I have a .htaccess file that allows PHP to work on HTML pages and I can do a simple include on any HTML page on the site, something like...
...works OK. But the PHP below which is an include plus extra PHP code doesn't work on a HTML page (but does if the same file is renamed .php)
Any ideas why it doesn't work. Do I have to move it into the head and call it below?
I could rename the .html page .php but would be a pain as it's the index and is linked to from many sites etc.
Hope you can help.
// get DOM from URL or file
$html = file_get_html('news-info-school-status.html');
// find all div tags with id=copystatus
foreach($html->find('div#copystatus') as $e)
echo $e->innertext . '<br>';