Skip to content

Instantly share code, notes, and snippets.

@wilcorrea
Last active October 5, 2016 22:04
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 wilcorrea/0afae957c92f4c49beeef2e46481f73a to your computer and use it in GitHub Desktop.
Save wilcorrea/0afae957c92f4c49beeef2e46481f73a to your computer and use it in GitHub Desktop.
receive use cors
<?php
header("Access-Control-Allow-Origin: *");
$output = [
'input' => null,
'post' => null,
'get' => null,
];
$input = file_get_contents('php://input');
if ($input) {
$output['input'] = json_decode($input);
}
$post = $_POST;
if ($post) {
$output['post'] = $post;
}
$get = $_GET;
if ($get) {
$output['get'] = $get;
}
var_dump($output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment