Last active
November 1, 2023 17:59
-
-
Save cupertinobr/82258531f9db4480ee39f1b0ce5401dd to your computer and use it in GitHub Desktop.
ScriptCaseRESTService
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
/* | |
Crie uma app blank: RESTService | |
- no onExecute insira os códigos abaixo | |
- Crie os metodos, no meu exemplo eu criei um metodo chamado checkLicense() quere recebe a variavel $body | |
- a variavel $boby recebe o input (os dados que vai enviar em formato json) | |
*/ | |
header("Access-Control-Allow-Origin: *"); | |
header("Access-Control-Allow-Headers: access"); | |
header("Access-Control-Allow-Methods: POST"); | |
header("Access-Control-Allow-Credentials: true"); | |
header("Content-Type: application/json"); | |
$body = file_get_contents("php://input"); | |
$query = $_SERVER['QUERY_STRING']; | |
$method = strtoupper($_SERVER['REQUEST_METHOD']); | |
switch( $method ) | |
{ | |
case 'GET': | |
break; | |
case 'POST': | |
checkLicense($body); | |
break; | |
case 'PUT': | |
break; | |
case 'DELETE': | |
break; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment