Skip to content

Instantly share code, notes, and snippets.

@eurica
Created November 8, 2010 17:31
Show Gist options
  • Save eurica/667972 to your computer and use it in GitHub Desktop.
Save eurica/667972 to your computer and use it in GitHub Desktop.
the minimum viable raplet
<?php
/*
David Hayes [email protected]
Quasi-minimal viable Raplet:
// */
$in = $_GET; //[email protected]&name=Rahul%20Vohra&twitter_username=rahulvohra&callback=jsonp123456789
$jsonContainer = $in['callback'];
//It's nice to see what's going on, this is optional :
$er = error_reporting(); error_reporting(0); //Suppress errors, JSON doesn't show them
$fp = fopen('.log', 'a+'); //On apache .filenames are hidden by default :)
fwrite($fp, "\n\n".date('l jS \of F Y h:i:s A')."\n");
fwrite($fp, print_r($in,true));
fclose($fp);
error_reporting($er);
$html = "Hello World: ".$in['email'];
$css = "";
$js = "";
?>
<?= $jsonContainer ?> ({
"html": "<?= $html ?>",
"css": "<?= $css ?>",
"js": "<?= $js ?>",
"status": 200
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment