-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.php
72 lines (72 loc) · 3.33 KB
/
list.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous" rel="stylesheet" />
<link href="tablesorter.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.28.15/js/jquery.tablesorter.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.28.15/js/jquery.tablesorter.widgets.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.0/jquery.mark.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.28.15/js/widgets/widget-mark.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="tablesorter.js"></script>
<title>Ürünler</title>
</head>
<body>
<?php
include_once('simple_html_dom.php');
$html = new simple_html_dom();
$html->load_file($_POST["link"]);
$products = array();
foreach ($html->find('li[class="search-item col lg-1 md-1 sm-1 custom-hover not-fashion-flex"]') as $li) {
$product = array();
$product['name'] = $li->find('p[class="hb-pl-cn"]')[0]->find('span')[0]->innertext;
$product['link'] = '<a href="http://www.hepsiburada.com' . $li->find('a')[0]->href . '">link</a>';
$product['image'] = '<img src="' . $li->find('img')[0]->src . '"></img>';
$span = $li->find('span[class="price product-price"]');
if (count($span) > 0) {
$product['price'] = $span[0]->innertext;
}
else {
continue;
}
$del = $li->find('del[class="price old product-old-price"]');
if (count($del) > 0) {
$product['old_price'] = $del[0]->innertext;
}
else {
$product['old_price'] = $span[0]->innertext;
}
array_push($products, $product);
}
?>
<div class="container">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>İsim</th>
<th>İndirimsiz Fiyat</th>
<th>İndirimli Fiyat</th>
<th class="sorter-false filter-false">Foto</th>
<th class="sorter-false filter-false">Link</th>
</tr>
</thead>
<tbody>
<?php foreach($products as $product) { ?>
<tr>
<td><?php echo $product['name']; ?></td>
<td><?php echo $product['old_price']; ?></td>
<td><?php echo $product['price']; ?></td>
<td><?php echo $product['image']; ?></td>
<td><?php echo $product['link']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</body>
</html>