|
|
|
|
@ -19,7 +19,9 @@ class simple_rest { |
|
|
|
|
return ['uri' => $uri, 'method' => $request_method]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// https://developer.okta.com/blog/2019/03/08/simple-rest-api-php |
|
|
|
|
/** |
|
|
|
|
* @link https://developer.okta.com/blog/2019/03/08/simple-rest-api-php |
|
|
|
|
*/ |
|
|
|
|
public function set_http_headers($content_type = "application/json; charset=UTF-8", $status_code = 200) { |
|
|
|
|
$status_message = $this->get_http_status_message($status_code); |
|
|
|
|
header("Access-Control-Allow-Origin: *"); |
|
|
|
|
@ -30,7 +32,9 @@ class simple_rest { |
|
|
|
|
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// https://phppot.com/php/php-restful-web-service/ |
|
|
|
|
/** |
|
|
|
|
* @link https://phppot.com/php/php-restful-web-service/ |
|
|
|
|
*/ |
|
|
|
|
public function get_http_status_message($status_code): string { |
|
|
|
|
return match ($status_code) { |
|
|
|
|
100 => 'Continue', |
|
|
|
|
|