function grabNextpage($arrUrlFormat, $yhd_cid) { $page = 1; while (true) { foreach ($arrUrlFormat as $key => $urlFormat) { $url = sprintf($urlFormat, $page); try { $response = grabWebPage($url); } catch (Exception $e) { println('backup hit, skip'); continue; } $json = json_decode($response, true); $html = $json['value']; if (!findItems($html, $yhd_cid)) { break 2; } // backup pageBackup($url, $response); } $page++; } }
function defHP() { findItems(); echo "\n <div class='col-sm-4'>\n <div class='panel-group'>\n <div class='panel panel-primary'>\n <div class='panel-heading basecolours'>\n <h1>Search for an item</h1>\n </div>\n <div class='panel-body basecolours' align='center'>\n <form class='input-group' role='form' method='get' action='search.php' >\n <input type='text' name='search' class='form-control' id='search' placeholder='Search...' >\n <span class='input-group-btn''>\n <button class='btn btn-primary' type='submit' value='Submit'>\n <span class='glyphicon glyphicon-search'></span>\n </button>\n </span>\n </form>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n "; topItems(); }