You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.2 KiB
55 lines
1.2 KiB
<?php
|
|
|
|
$english = mysql_escape_string($_REQUEST['translate']);
|
|
// Der Service ist zur Zeit leider deaktiviert....
|
|
// $trans = new SoapClient(
|
|
// "http://www.xmethods.net/sd/2001/BabelFishService.wsdl");
|
|
|
|
/*
|
|
try
|
|
{
|
|
$german = $trans->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);
|
|
}
|
|
|
|
?>
|