Created
November 8, 2010 17:32
-
-
Save eurica/667976 to your computer and use it in GitHub Desktop.
minimum viable raplet 2
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
<?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); | |
if($in['show']=='metadata') { //display the metadata JSON ?> | |
<?= $jsonContainer ?> ({ | |
"name": "CrunchBase", | |
"description": "Essential intelligence for every entrepreneur and investor. ", | |
"welcome_text": "<h1>Sample</h1><p>Cras mauris augue, lacinia et commodo ut, feugiat eget tortor. Maecenas luctus rutrum justo, vel luctus sem elementum ut. Praesent nec sollicitudin tortor. Fusce consequat, urna eget aliquet dictum, eros diam sagittis lacus, sit amet auctor erat sem ut risus. Pellentesque et augue ac lacus volutpat hendrerit. Sed volutpat sodales rhoncus. Vivamus in sapien ut enim pellentesque rhoncus. -<a href="http://euri.ca">euri.ca</a></p>", | |
"icon_url": "http://test.ultrasaur.us/public/raplet/icon.png", | |
"preview_url": "http://test.ultrasaur.us/public/raplet/preview.png", | |
"provider_name": "Euri.ca", | |
"provider_url": "http://euri.ca/", | |
}) | |
<? | |
exit(); | |
} | |
$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