-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·42 lines (29 loc) · 1.03 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
<?php
require_once('lib/SnapSearch-Client-PHP/src/SnapSearchClientPHP/Bootstrap.php');
\SnapSearchClientPHP\Bootstrap::register();
$client = new \SnapSearchClientPHP\Client('email', 'key');
$detector = new \SnapSearchClientPHP\Detector;
$interceptor = new \SnapSearchClientPHP\Interceptor($client, $detector);
// //exceptions should be ignored in production, but during development you can check it for validation errors
try{
$response = $interceptor->intercept();
}catch(SnapSearchClientPHP\SnapSearchException $e){}
if($response){
header(' ', true, $response['status']); //as of PHP 5.4, you can use http_response_code($response['status']);
if(!empty($response['headers'])){
foreach($response['headers'] as $header){
if($header['name'] == 'Location'){
header($header['name'] . ': ' . $header['value']);
}
}
}
echo $response['html'];
}else{
?>
<html>
<head><title>Your Website</title></head>
<body><p>HELLO!</p></body>
</html>
<?php
}
?>