4 * Render the bookmarks/comments/links for a given URL
6 * @param string $url URL to get content for
8 header('HTTP/1.0 500 Internal Server Error');
9 header('Content-type: text/plain');
11 require_once __DIR__ . '/../data/config.php';
12 require_once 'stapibas/autoloader.php';
14 if (!isset($_GET['url'])) {
15 header('HTTP/1.0 400 Bad Request');
16 echo "HTTP POST 'url' parameter missing\n";
21 header('HTTP/1.0 400 Bad Request');
22 echo "'url' parameter is empty\n";
25 if (filter_var($url, FILTER_VALIDATE_URL) === false) {
26 header('HTTP/1.0 400 Bad Request');
27 echo "Invalid URL given\n";
32 $deps = new Dependencies();
33 $deps->db = new PDO($dbdsn, $dbuser, $dbpass);
34 $deps->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
35 $deps->options = array(
36 'template_dir' => __DIR__ . '/../data/templates/default/'
39 $r = new Renderer_Html($deps);
40 echo $r->render($url);