function main()
{
    $text = '';
    $format = '';
    if (isset($_POST['text']) && $_POST['text'] != '') {
        $text = $_POST['text'];
        $format = $_POST['format'];
        find_specimens($text, $format);
    } else {
        display_form();
    }
}
Example #2
0
//echo $json;
$reference = json_decode($json);
$page_count = 1;
foreach ($reference->bhl_pages as $k => $PageID) {
    // URI for page so we can locate annotations
    $uri = 'http://biostor.org/reference/' . $id . '/page/' . $page_count;
    // fetch page
    $url = 'http://localhost/~rpage/biostor/api.php?page=' . $PageID . '&format=html';
    $json = get($url);
    //echo $json;
    $obj = json_decode($json);
    if (isset($obj->html)) {
        $page = html_to_page($obj->html);
        $hits = array();
        if (0) {
            $hits = array_merge($hits, find_specimens($page->text));
        }
        if (1) {
            $hits = array_merge($hits, find_points($page->text));
        }
        if (0) {
            $hits = array_merge($hits, find_genbank($page->text));
        }
        $annotations = annotations_from_hits($uri, $page, $hits);
        echo "annotations\n";
        print_r($annotations);
        foreach ($annotations as $annotation) {
            echo json_encode($annotation->data);
            $h->add_annotation($annotation->data);
            echo "\n";
        }