Newer
Older
<?php
namespace SmartData;
require_once('../bin/smartdata/SmartAPI.php');
use function SmartData\SmartAPI\batch;
use SmartData\Exception\CustomException;
use SmartData\Logger;
http_response_code(HttpStatusCode::BAD_REQUEST);
try {
$content = file_get_contents('php://input');
$response = batch($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;