Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created November 10, 2019 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/160ea6828bb4984730321fe4aa201e62 to your computer and use it in GitHub Desktop.
Save parzibyte/160ea6828bb4984730321fe4aa201e62 to your computer and use it in GitHub Desktop.
<?php
include_once "cors.php";
$persona = json_decode(file_get_contents("php://input"));
$mensaje = "El nuevo nombre de la persona es: " . $persona->nombre;
echo json_encode($mensaje);
<?php
/*
Programado por Luis Cabrera Benito
____ _____ _ _ _
| _ \ | __ \ (_) | | |
| |_) |_ _ | |__) |_ _ _ __ _____| |__ _ _| |_ ___
| _ <| | | | | ___/ _` | '__|_ / | '_ \| | | | __/ _ \
| |_) | |_| | | | | (_| | | / /| | |_) | |_| | || __/
|____/ \__, | |_| \__,_|_| /___|_|_.__/ \__, |\__\___|
__/ | __/ |
|___/ |___/
Blog: https://parzibyte.me/blog
Ayuda: https://parzibyte.me/blog/contrataciones-ayuda/
Contacto: https://parzibyte.me/blog/contacto/
*/
$dominioPermitido = "https://servicio-http-angular.stackblitz.io";
header("Access-Control-Allow-Origin: $dominioPermitido");
header("Access-Control-Allow-Headers: content-type");
header("Access-Control-Allow-Methods: OPTIONS,GET,PUT,POST,DELETE");
<?php
include_once "cors.php";
$idPersona = $_GET["id"];
$mensaje = "Ok se elimina a la persona con id $idPersona";
echo json_encode($mensaje);
<?php
include_once "cors.php";
$personas = [
[
"nombre"=>"Luis",
"edad" => 22
],
[
"nombre"=>"Fernando",
"edad" => 50
],
];
echo json_encode($personas);
<?php
include_once "cors.php";
$persona = json_decode(file_get_contents("php://input"));
$mensaje = "El nombre de la persona es: " . $persona->nombre;
echo json_encode($mensaje);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment