-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathflipkart.php
More file actions
32 lines (21 loc) · 823 Bytes
/
flipkart.php
File metadata and controls
32 lines (21 loc) · 823 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
29
30
31
32
<?php
require_once "core.php";
function flipkart($search)
{
$search = str_replace(" ", "%20", $search);
$url = "http://www.flipkart.com/search?q=$search";
$html = getHTMLcode($url);
$regex = '/<a class="fk-display-block" data-tracking-id="prd_title" href="[^"]*" title="(?P<name>[^"]*)">/'; //(?P<name>[^<]*)/'; //*"([^"]*)>/';
preg_match_all($regex, $html, $title);
$regex = '/data-src="(?P<img>[^"]*)"/';
preg_match_all($regex, $html, $image);
$regex = '/<span class="fk-font-17 fk-bold">(?P<cost>[^<]*)<\/span>/';
preg_match_all($regex, $html, $price);
if(empty(@$price[cost]))
{
$regex = '/<span class="fk-font-12">(?P<cost>[^<]*)<\/span>/';
preg_match_all($regex, $html, $price);
}
return Array(@$title[name],@$image[img],@$price[cost]);
}
?>