Using simplehtmldom in singlepage
Permalink
Hi all,
I've spent the evening getting my head around using simplehtmldom to import HTML from an external site and when used just in a standalone PHP file it worked beautifully using the following:
However as soon as I dropped the code into my singlepage I get the following error:
By looking into it a bit deeper I see that Concrete5 actually uses simplehtmldom as noted in the error but I'm not sure how to get around this.
I am still bit of noob when it comes to PHP and have just about exhausted my troubleshooting abilities.
Any help would be greatly appreciated.
I've spent the evening getting my head around using simplehtmldom to import HTML from an external site and when used just in a standalone PHP file it worked beautifully using the following:
<?php require_once 'libs/simple_html_dom.php'; $ladderpage = file_get_html('http://www.foxsportspulse.com/comp_info.cgi?a=LADDER&compID=390941&c=1-6208-0-0-0'); $ladder = $ladderpage->find('table', 0); $ladderdata = array(); foreach($ladder->find('tr') as $ladderrow) { // initialize array to store the cell data from each row $ladderlist = array(); foreach($ladderrow->find('td') as $cell) { // push the cell's text to the array $ladderlist[] = $cell->plaintext; } $ladderdata[] = $ladderlist; } echo '<table>';
Viewing 15 lines of 23 lines. View entire code block.
However as soon as I dropped the code into my singlepage I get the following error:
Cannot redeclare file_get_html() (previously declared in C:\Users\Richard\Dropbox\NextCode Creative\Website Design\Test Sites\Traralgon Football Club\concrete\vendor\sunra\php-simple-html-dom-parser\Src\Sunra\PhpSimple\simplehtmldom_1_5\simple_html_dom.php:70)
By looking into it a bit deeper I see that Concrete5 actually uses simplehtmldom as noted in the error but I'm not sure how to get around this.
I am still bit of noob when it comes to PHP and have just about exhausted my troubleshooting abilities.
Any help would be greatly appreciated.