I am trying to build a really minimalistic API for Zoover (The holiday review website) and I want to load in the testimonials but they create a different id for each testimonial. Does someone know how I can get the id of the li
This is the code I have already, this just echo's the first testimonial because they all have a different id:
<?php
include_once('libs/simple_html_dom.php');
$html = file_get_html("http://www.zoover.nl/indonesie/lombok/senggigi/campi-sorga/villa/?s=P2xuZz1MYW5ndWFnZV9BTEwmcGFydHlDb21wRmx0SWQ9JnRzdF9wZ3NpemU9MTAmc29ydD1jb250cmlidXRpb24tZGF0ZQ==&page=0");
foreach($html->find('#testimonial13247814 > article > header > h3') as $element)
echo $element . "<br>";
?>
Hope someone knows how I can fix this.
Obviously, don't point to the ID, use the parent <ul>
then get its <li>
children instead:
$elements = $html->find('ul.zvr-contributions-list > li > article > header > h3');
if(!empty($elements)) {
foreach($elements as $element) {
echo $element;
}
}