-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
47 lines (38 loc) · 887 Bytes
/
index.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
<html>
<form action="" method="post" >
Insert the prodcut link:
<input type="text" name="un">
<input type="submit" value="Get Price" name="submit" />
</form>
<?php
// link of the amazon product
if (isset($_POST['un'])) {
$link = $_POST["un"];
$page_content = file_get_contents($link);
$res=preg_match('/"priceblock_ourprice".*\₹(.*)</i',
$page_content, $matches);
$res2=preg_match('/"priceblock_dealprice".*\₹(.*)</i',
$page_content, $matches2);
$res3=preg_match('/"priceblock_saleprice".*\₹(.*)</i',
$page_content, $matches3);
if($res) {
$price = trim($matches[1]);
}
elseif($res2){
$price=trim($matches2[1]);
}
elseif($res3)
{
$price=trim($matches3[1]);
}
else {
echo "Price not found.";
$price = 0;
}
if($price)
{
echo "The Price of given Product is ₹".$price;
}
}
?>
</html>