-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.php
More file actions
27 lines (22 loc) · 723 Bytes
/
Copy pathapp.php
File metadata and controls
27 lines (22 loc) · 723 Bytes
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
<?php
require 'vendor/autoload.php';
require 'src/html_loader.php';
$app = new \Slim\Slim(array('debug'=>true,'templates.path'=>__DIR__."/templates"));
$app->get("/", function() use ($app){
$app->render("main.html");
});
$app->post("/",function() use ($app){
try{
$url = $app->request->post("urlInput");
$html_load = new HtmlLoader($url);
$html_load->load_html_content();
$html_load->parse_html_to_json();
$app->render("post.html",array("url"=>$url,"html"=>$html_load->get_html(),"json"=>$html_load->get_json_result()));
// $app->render("main.html",array("url"=>$url,"html"=>$html_load->get_html()));
} catch(Exception $e){
echo "Something goes wrong";
echo $e;
}
});
$app->run();
?>