UrlManipulator-php/server/index.php

14 lines
No EOL
348 B
PHP

<?php
ini_set('display_errors', 1);
require('./autoloader.php');
use urlManipulator\UrlManipulator;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$urlManipulator = new UrlManipulator();
$url = $_POST['url'];
$result = $urlManipulator->manipulateUrl($url);
header('Content-Type: application/json');
echo json_encode($result);
}