Skip to content

Instantly share code, notes, and snippets.

@AlexisTM
Created January 31, 2018 15:45
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 AlexisTM/7d4cc01d7e125b34868ad55f99314845 to your computer and use it in GitHub Desktop.
Save AlexisTM/7d4cc01d7e125b34868ad55f99314845 to your computer and use it in GitHub Desktop.
<?php
include 'json.php';
function cache_get($key) {
@include "/tmp/$key";
return isset($val) ? $val : false;
}
$response = new \Simple\json();
if(isset($_POST["name"])){
 $name = $_POST["name"];
} else if(isset($_GET["name"])) {
 $name = $_GET["name"];
} else {
 $response->success = False;
 $response->send();
 exit();
}
$data = cache_get($name);
$response->name = $name;
$response->data = $data;
$response->send();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment