public function index() { $cat = null; if (Core::checkRequiredGetVars('cat')) { $cat = $_GET['cat']; } $this->setTitle('Achilles'); $m = new ModelPost(); $this->addContent('posts', $m->getPostsByDay($cat)); }
public function scrap() { if (!isset($_POST) || !isset($_POST["url"])) { Core::performResponse(SimpleJSON::encode(array("error" => "Url missing.")), "json"); } $return = array("request" => array("post" => $_POST)); $url = $_POST["url"]; $m = new ModelPost(); try { $return["data"] = $m->retrieveDataFrom($url); } catch (\Exception $e) { Core::performResponse(SimpleJSON::encode(array("error" => "Unable to retrieve infos.", "details" => $e->getMessage())), "json"); } Core::performResponse(SimpleJSON::encode($return), "json"); }