Skip to content

Instantly share code, notes, and snippets.

View ouendinga's full-sized avatar

Álvaro Solís Pascual ouendinga

View GitHub Profile
@ouendinga
ouendinga / api.php
Last active October 24, 2019 13:52
<?php
// Run server: "php -S localhost:8888 api.php"
// get the HTTP method, path and body of the request
$method = $_SERVER['REQUEST_METHOD'];
$request = explode('/', trim($_SERVER['PATH_INFO'],'/'));
$input = json_decode(file_get_contents('php://input'),true);
// connect to the mysql database