15 lines
No EOL
405 B
PHP
15 lines
No EOL
405 B
PHP
<?php
|
|
// require autoloader
|
|
require('./autoloader.php');
|
|
|
|
use urlManipulator\UrlManipulator;
|
|
|
|
// handle POST requests
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$urlManipulator = new UrlManipulator();
|
|
$url = $_POST['url'];
|
|
$result = $urlManipulator->manipulateUrl($url);
|
|
// send the result as a JSON response
|
|
header('Content-Type: application/json');
|
|
echo json_encode($result);
|
|
} |