diff --git a/ajax+json/.ajax.php.swp b/ajax+json/.ajax.php.swp new file mode 100644 index 0000000..06c1669 Binary files /dev/null and b/ajax+json/.ajax.php.swp differ diff --git a/ajax+json/ajax.php b/ajax+json/ajax.php new file mode 100644 index 0000000..902b3fc --- /dev/null +++ b/ajax+json/ajax.php @@ -0,0 +1,55 @@ +BabelFish("en_de",$english); + $french = $trans->BabelFish("en_fr",$english); + } + catch(SoapFault $e) + { + $english = "not found"; + $german = "not found"; + $french = "not found"; + } +*/ + $encoding = FALSE; + if (isset ($_SERVER['HTTP_ACCEPT_ENCODING']) && + strpos ($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !== FALSE) + $encoding = "x-gzip"; + if (isset ($_SERVER['HTTP_ACCEPT_ENCODING']) && + strpos ($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE) + $encoding = "gzip"; + + header ('Content-type: text/plain'); + + $result = FALSE; + if ($encoding !== FALSE) + $result = gzcompress (json_encode (array( + "english" => 'doing gzip', + "german" => 'gezipedte Daten', + "french" => 'la zippo'))); + + if ($result !== FALSE) + { + header ('Content-Encoding: ' . $encoding); + + print ("\x1f\x8b\x08\x00\x00\x00\x00\x00"); + print ($result); + } + else + { + $result = json_encode (array( + "english" => 'doing no gzip', + "german" => 'nicht gezipedte Daten', + "french" => 'no la zippo')); + + print ($result); + } + +?> diff --git a/ajax+json/test1.html b/ajax+json/test1.html new file mode 100644 index 0000000..a1fde3e --- /dev/null +++ b/ajax+json/test1.html @@ -0,0 +1,96 @@ + +
+