コード例 #1
0
  http://httparchive.org/viewsite.php?pageid=[pageid]
As well as the HAR URL:
  http://httparchive.webpagetest.org/export.php?test=[wptid]&run=[medianrun]&cached=0&pretty=1
The most typical usage is simply:
  http://dev.httparchive.org/crawl-data.php
*/
require_once "ui.inc";
require_once "utils.inc";
if (getParam("crawlid")) {
    $crawl = getCrawlFromId(getParam("crawlid"));
} else {
    if (getParam("label")) {
        $crawl = getCrawl(getParam("label"));
    } else {
        // This is the latest crawl regardless of whether it's finished.
        $crawl = latestCrawl(null, null, false);
    }
}
if ($crawl["finishedDateTime"]) {
    // Add all the info about pages crawled.
    $crawl["pages"] = array();
    $query = "select pageid, wptid, wptrun from {$gPagesTable} where crawlid = {$crawl['crawlid']} order by pageid asc;";
    $result = doQuery($query);
    while ($row = mysql_fetch_row($result)) {
        array_push($crawl["pages"], $row);
    }
    mysql_free_result($result);
}
$response = json_encode($crawl);
$jsonp = getParam("jsonp");
if ($jsonp) {
コード例 #2
0
ファイル: viewsite.php プロジェクト: shanshanyang/httparchive
$pageData = null;
if (getParam('pageid')) {
    $gPageid = getParam('pageid');
    $pageData = pageData($gPageid);
} else {
    if (!isset($gPageid) && getParam('u') && getParam('l')) {
        $url = getParam('u');
        $gLabel = getParam('l');
        $pageData = pageData(null, $url, $gLabel);
    } else {
        if (!isset($gPageid) && getParam('u')) {
            $url = getParam('u');
            $pageData = pageData(null, $url, null, getParam('h'));
        } else {
            if (getParam('rand')) {
                $crawl = latestCrawl();
                $gPageid = randomPageid($crawl);
                $pageData = pageData($gPageid);
            } else {
                // should never reach here
                header('Location: websites.php');
                return;
            }
        }
    }
}
// TODO - better error handling starting here!
// Changed to select * to allow summary paragraph
if (!$pageData) {
    header('Location: websites.php');
    return;