scraper monitoring page
[disclosr.git] / documents / viewDocument.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
 
include_once('../include/common.inc.php');
$hash = $_REQUEST['hash'];
$docsdb = $server->get_db('disclosr-documents');
try {
    $doc = object_to_array($docsdb->get($hash));
 
} catch (SetteeRestClientException $e) {
    setteErrorHandler($e);
}
 
 
if (!isset($doc['_attachments']) || count($doc['_attachments']) == 0) die ("no attachments");
$attachments = $doc['_attachments'];
$attachment_filenames = array_keys($attachments);
//print_r($attachments);
$url = $serverAddr . 'disclosr-documents/' . $hash . '/' . urlencode($attachment_filenames[0]);
//echo $url;
$request = Requests::get($url);
echo ($request->body);