- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
$type = ($_POST['type'] == 'any') ? '' : str_replace(' ', '%20', str_replace('|','%7C', $_POST['type']));
$make = ($_POST['make'] == 'any') ? '' : str_replace(' ', '%20', str_replace('|','%7C', $_POST['make']));
$url = 'http://www.cycletrader.com/search-results?sort=featured%3Aasc&page='.$_POST['page'].'&type='.$type.'&make='.$make;
$str = getCurlObject($url);
$content = multiexplode('<div id="searchPage"', '<div class="footer', $str);
$list = multiexplode('<div id="gridView"', '<div class="rezDetailsBtm', $content);
$field = explode('<div data-url=', $list);
for ($k = 1; $k < count($field); $k++) {
$title_tmp = multiexplode('<a class="listing-info-title', '</a>', $field[$k]);
$title = multiexplode('title="', '"', $title_tmp);
$link = $lang['dir'].'detail?'.$_POST['form'].'&'.multiexplode('href="', '"', $title_tmp);
$img_tmp = multiexplode('<img', '/>', $field[$k]);
$img = multiexplode('data-src="', '"', $img_tmp);
$price_tmp = multiexplode('class="price', '</span>', $field[$k]);
if (strripos($price_tmp,'<span class="mileage">')) {
$price = multiexplode('<span>', '<span', $price_tmp);
} else {
$price = multiexplode('<span>', '</span>', $price_tmp);
}
if (trim($price) == 'Call for price') $price = '';
$result['item'][$k]['link'] = $link;
$result['item'][$k]['title'] = $title;
$result['item'][$k]['img'] = $img;
$result['item'][$k]['price'] = $price;
$result['item'][$k]['location'] = $location;
}
if (strripos($content,'<div class="pagination')) {
$pagination = multiexplode('<div class="pagination', '</div>', $content);
$pagination_tmp = multiexplode('<span class="hidden-xs','</div>', $pagination);
$pagination_item = explode('<li', $pagination);
if (count($pagination_item) > 6) {
$result['pagination'] = true;
}
}