I i am tryng to make a website that get the car parts of a selected vehicle model, i get the values like the engine, air filter, oil filter and i want to make a table like the one that is on the website that containt this informations.
This code works but i dont know how to format a table depending on how many tables are on the other website.
I have used simple html dom.
This is the link:
PURFLUX[
^]
I hope someone can help me, like showing me some code in order to understand, Thanks!!!
require_once 'simple_html_dom.php';
$curl3 = curl_init();
curl_setopt($curl3, CURLOPT_URL, "http://www.sogefifilterdivision.com/catalogues/FO/scripts/cat_rech_vehicules.php?zone=FR&catalogue=CPF&lang=IT&vehicule_marque=FIAT&vehicule_modele=Punto+Evo+1.3+Multijet+16V");
curl_setopt($curl3, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl3, CURLOPT_CONNECTTIMEOUT, 10);
$html = new simple_html_dom();
$html = str_get_html(curl_exec($curl3));
echo $html->find('table',0)."<br><br>";
echo "<table style='border:1px solid black;width:400px;'>";
foreach ($html->find('table tr') as $key => $value) {
$txt = $value->plaintext;
echo "<tr><td>".$txt."</td></tr>";
}
echo "</table>";
What I have tried:
I have tried to make and array and get the data but it has some problems, maybe i have to make a bydimensional array, the problem is that on the page that i want to get the data there are lots of tables whith the same class and no id.