Skip to content
Snippets Groups Projects
put.php 620 B
Newer Older
root's avatar
root committed
<?php
namespace SmartData;

require_once('../bin/smartdata/SmartAPI.php');
use function SmartData\SmartAPI\put;
use SmartData\Exception\CustomException;
use SmartData\Logger;

http_response_code(HttpStatusCode::BAD_REQUEST);

try {
    $content = file_get_contents('php://input');
    $response = put($content);
}catch(CustomException $e){
    http_response_code($e->getHTTPCodeError());
    Logger::exception($e);
    return false;
}catch(\Exception $e){
    http_response_code(HttpStatusCode::BAD_REQUEST);
    Logger::exception($e);
    return false;
}

http_response_code(HttpStatusCode::NO_CONTENT);
echo $response;