-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathamazon.php
More file actions
28 lines (15 loc) · 771 Bytes
/
amazon.php
File metadata and controls
28 lines (15 loc) · 771 Bytes
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
<?php
require_once "core.php";
function amazon($search)
{
$url="http://www.amazon.in/s/ref=nb_sb_noss/280-5472358-5762825?url=search-alias%3Daps&field-keywords=$search";
$html= getHTMLcode($url);
$image = '/<img alt="Product Details" src="(?P<img>[^"]*)"/';
preg_match_all($image,$html,$data);
$title = '/<h2 class="a-size-medium a-color-null s-inline s-access-title a-text-normal">(?P<val>[^>]*)<\/h2>/';
preg_match_all($title,$html,$value);
$price ='/<span class="a-size-base a-color-price s-price a-text-bold"><span class="currencyINR"> <\/span>(?P<price>[^>]*)<\/span>/';
preg_match_all($price,$html,$cost);
return Array(@$value[val], @$data[img], @$cost[price]);
}
?>