4 * Get a screenshot for a website.
6 header('HTTP/1.0 500 Internal Server Error');
8 if (file_exists(__DIR__ . '/../src/phancap/Autoloader.php')) {
9 include_once __DIR__ . '/../src/phancap/Autoloader.php';
10 Autoloader::register();
12 include_once 'phancap/Autoloader.php';
15 $config = new Config();
16 $config->setupCheck();
18 $options = new Options();
20 $options->parse($_GET);
21 } catch (\InvalidArgumentException $e) {
22 header('HTTP/1.0 400 Bad Request');
23 header('Content-type: text/plain');
24 echo $e->getMessage() . "\n";
28 $rep = new Repository();
29 $rep->setConfig($config);
31 $img = $rep->getImage($options);
32 header('HTTP/1.0 302 Found');
33 header('Location: ' . $img->getUrl());
34 } catch (\Exception $e) {
35 //FIXME: handle 404s and so properly
36 header('HTTP/1.0 500 Internal Server error');
37 header('Content-type: text/plain');
38 echo $e->getMessage() . "\n";