1. PHP / Говнокод #25127

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 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;
        }
    }

    Стандартный похокод пыходибила.

    Запостил: хуита, 28 Ноября 2018

    Комментарии (10) RSS

    Добавить комментарий