-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse.php
More file actions
33 lines (21 loc) · 827 Bytes
/
parse.php
File metadata and controls
33 lines (21 loc) · 827 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
28
29
30
31
32
<?php
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Credentials: true");
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, X-Requested-With, Authorization');
header('Content-Type: application/json');
require __DIR__ . '/Parser.php';
if ($_SERVER['REQUEST_METHOD'] !== 'POST' || empty($_POST['requirement'])) {
die('Only Post Method is allowed');
}
$requirementBody = strip_tags($_POST['requirement']);
$requirements = explode('##########', $requirementBody);
$requirements = array_map(function($value) {
$parser = new Parser($value);
return $parser->returnRequirements();
}, $requirements);
//echo '<pre>';
//print_r($requirements);
//echo '</pre>';die;
echo json_encode($requirements);
exit();