forked from IntelligenceX/SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
50 lines (40 loc) · 1.4 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
require_once realpath(dirname(__FILE__) . '/lib') . '/IntelligentSearchRequest.php';
require_once realpath(dirname(__FILE__) . '/lib') . '/IntelligentSearchResult.php';
require_once realpath(dirname(__FILE__) . '/lib') . '/searchAPI.php';
define('LOG_API', false);
define('LOG_DIR', realpath(dirname(__FILE__) . '/log'));
$term = filter_input(INPUT_GET, 'searchField');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Intelx.io - search results</title>
</head>
<body>
<form>
<fieldset>
<legend>Enter your search phrase</legend>
<input type="search" name="searchField" placeholder="Search topics or keywords" size="50" value="<?php echo htmlspecialchars($term) ?>">
<button type="submit" id="btnSearch">Search</button>
</fieldset>
</form>
<div id="searchResults">
<?php
if ('' != $term):
$api = new searchAPI();
$api->setApiKey('9df61df0-84f7-4dc7-b34c-8ccfb8646ace');
$api->setApiUrl('https://public.intelx.io/');
$request = new IntelligentSearchRequest($api);
$request->search($term);
foreach ($request->getResults($term) as $record): ?>
<h3><?php echo $record->name ?> </h3>
<?php echo $record->date ?><br><pre><?php echo $record->filePreview() ?></pre><br><a href="https://intelx.io/?did=<?php echo $record->systemid ?>" target="_blank">Full Data</a><hr>
<?php endforeach; ?>
<?php endif; ?>
</div>
</body>
</html>