Created
May 30, 2024 13:19
-
-
Save alexlatam/1a322f5606f4ae35a5406e02dfe8ae0f to your computer and use it in GitHub Desktop.
Simple Api on Pure PHP - Without frameworks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
init_set('display_errors', 0); | |
init_set('html_errors', 0); | |
$message = new stdClass(); | |
$message->content[0] = "Hi there!"; | |
$message->content[1] = "See you later"; | |
/** Headers Response **/ | |
header('Content-Type: application/json; charset=utf-80); // response tpye | |
header('HTTP:1.1 200 OK'); // status code | |
echo json_encode($message); | |
exit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment