예제 #1
0
파일: api.php 프로젝트: kba/rssscrpr
    }
    if (Utils::contains($errstr, 'already defined')) {
        return;
    }
    if (Utils::contains($errstr, "htmlParseEntityRef: expecting ';'")) {
        return;
    }
    if (Utils::contains($errstr, "invalid in Entity")) {
        return;
    }
    error_log("WARNING: " . $errstr);
    if (Utils::contains($errstr, 'Unexpected end tag')) {
        return;
    }
    // Utils::throw400("WARNING:$errno: $errstr");
}
if (!isset($_GET['action'])) {
    Utils::throw400("Must set 'action'!");
}
if ($_GET['action'] === 'scrape-html') {
    $retriever = RetrieverFactory::createHtmlScraperFromQueryParams($_GET);
    $feed = $retriever->go();
    echoRSS($feed);
} else {
    if ($_GET['action'] === 'reflect') {
        header('Content-Type: application/json');
        echo Utils::reflectComponents();
    } else {
        Utils::throw400("Undefine action '{$_GET['action']}'!");
    }
}
예제 #2
0
<?php

require 'src/RetrieverFactory.php';
echo RetrieverFactory::reflectComponents();