Skip to content

Instantly share code, notes, and snippets.

@edorcutt
Created October 9, 2010 19:51
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 edorcutt/618544 to your computer and use it in GitHub Desktop.
Save edorcutt/618544 to your computer and use it in GitHub Desktop.
Kynetx Remote Annotation Web Service from Kynetx Annotate V 2.0 http://k-docs.s3.amazonaws.com/Annotate%20V%202.pdf
<?php
/*
* Kynetx Remote Annotation Web Service
* from Kynetx Annotate V 2.0
* http://k-docs.s3.amazonaws.com/Annotate%20V%202.pdf
* by Ed Orcutt
*/
// get the incoming annotate data
$json_request = $_GET['annotatedata'];
// call function to strip slashes if magic_quotes php.ini Directive is On
$json_decoded = json_decode(stripslashes($json_request));
$toReturn = array();
$count = 0;
//error_log(print_r($json_request));
//error_log(print_r($json_decoded));
foreach($json_decoded as $key => $item){
if ($item->domain == 'www.enterprise.com') {
$toReturn[$key] = array('discount' => 'Enterprise Discount 35%');
}
if ($item->domain == 'www.hertz.com') {
$toReturn[$key] = array('discount' => 'Hertz Discount 35%');
}
$count++;
}
$callback = $_GET['jsoncallback'];
if($callback){
echo $callback.'('.json_encode($toReturn).');';
} else {
echo json_encode($toReturn);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment