Esempio n. 1
0
<?php

ob_start();
require_once 'src/core/LightUrl.php';
if (empty($_GET['shortURL'])) {
    header("location:index.php");
} else {
    $light = new LightUrl();
    $shortURL = $_GET['shortURL'];
    $response = $light->getURLInfo($shortURL);
    if (empty($response->bulkUrl)) {
        header("location:index.php");
    } else {
        header("location:{$response->bulkUrl}");
    }
}
Esempio n. 2
0
<?php

ob_start();
header("Content-Type:application/json");
include "..\\src\\core\\LightUrl.php";
$light = new LightUrl();
$type = $_GET['type'];
if ($type == "shortURL") {
    $longURL = $_GET['longURL'];
    echo json_encode($light->urlShort($longURL));
} else {
    if ($type == "infoURL") {
        $shortURL = $_GET['shortURL'];
        $response = $light->getURLInfo($shortURL);
        echo json_encode($response);
    }
}
?>