<?php // 4 or greater// creates dedicated JSON outputfunction bytesonResponse($output, $utf8 = true){ // this response should be type of text/plain header('Content-Type: text/plain'.($utf8 ? '; charset=utf-8' : '')); header('Content-Length: '.strlen($output)); // and shouldn't be cached (please browser, don't use the cache) header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); // just exit, showing JSON result exit($output);}// if request is from bytesonif(isset($_POST['byteson'])) { // uses your favourite JSON parser require 'FastJSON.class.php'; // get, for example, some header (just to show something) $result = apache_request_headers(); // associative array // add everything You need $result['outpout'] = &$_POST['byteson']; if(get_magic_quotes_gpc()) // remove slashes if magic_quotes is enabled (damn magic_quote !!!) $result['outpout'] = stripslashes($result['outpout']); // show JSON object bytesonResponse(FastJSON::encode($result));}?>