Ruben Lamboni,
il y a 9 ans
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="css/bootstrap.css" rel="stylesheet">
<style type="text/css">
#content
{
width: 900px;
margin: 0 auto;
font-family:Arial, Helvetica, sans-serif;
}
.page
{
float: left;
margin: 0;
padding: 0;
}
.page li
{
list-style: none;
display:inline-block;
}
.page li a, .current
{
display: block;
padding: 5px;
text-decoration: none;
color: #8A8A8A;
}
.current
{
font-weight:bold;
color: #000;
}
.button
{
padding: 5px 15px;
text-decoration: none;
background:#4CB62B;
color: #F3F3F3;
font-size: 13PX;
border-radius: 2PX;
margin: 0 4PX;
display: block;
float: left;
}
</style>
</head>
<body>
<div id="content">
<?php
$debut="https://www.agriconomie.com";
$txt = file_get_contents('https://www.agriconomie.com/pieces-agricoles/tracteur/attelage---relevage/pc2902'); /*ici c'est pour Lire la page html*/
$results = array();
// $test = preg_match_all('#<a href="(.*?)">#', $txt, $names_array);
$test = preg_match_all('#<a href="(.+)" class="(.+)" title="(.+)"#', $txt, $names_array);
/*recupéré les liens du site en particuliers le text qui se situe entre griffe "" du href*/
for($i = 0; $i < count($names_array[1]); $i++)
{
$debut="https://www.agriconomie.com".$names_array[1][$i];
$adresse =$debut;
/* echo $adresse ; ?> <br /> <?php */
$page = file_get_contents ($adresse);
preg_match_all ('#<h1 class="product-title" itemprop="name">(.*)</h1>#', $page, $names_array5);
preg_match_all ('#(<dd>(.+)</dd>)#', $page, $names_array2);
preg_match_all ('#<span><i class="icon-chevron-right"></i>(.*?)</span>#', $page, $names_array3);
preg_match_all ('#<p class="price" itemprop="price" content="(.*?)">#', $page, $names_array4);
echo "<center>";
echo "<table class='table table-bordered table-striped table-condensed'>";
for($j = 0; $j < count($names_array5[1]); $j++)
{
$NOM = $names_array5[1][$j];
echo "<tr><th>".$NOM."</th>";
}
for($j=0; $j < count($names_array4[1]); $j++)
{
$price = $names_array4[1][$j];
echo" <th> ".$price."-€"."</th> </tr> ";
}
for($j = 0; $j < count($names_array3[1]); $j++)
{
$intitule = $names_array3[1][$j];
echo "<tr>";
for($k=$j; $k < count($names_array2[1]); $k++){
$descriptif = $names_array2[1][$k];
}
echo "<td>".$intitule." </td> <td> ".$descriptif." </td>" ;
echo" </tr> ";
}
}
echo "</table>";
echo "</center>";
?>
</div>
</body>
</html>
Ruben Lamboni,
il y a 9 ans
Je suis en collaboration avec les éditeurs du site Agriconomie, et voilà ma tache, je le fait en manuel et cela me fatigue je veux passer en automatique et la finir.
Thomas Chicheportiche,
il y a 9 ans
Salut,
Situ es en collaboration avec les éditeurs, pourquoi ne pas interfacer ton applications avec leurs données? Ta solution me semble douteuse dans sa manière à mettre en oeuvre. Et le jour où le site change ton application ne fonctionnera plus.