Example #1
0
<?php

require "googletranslate/GTranslate.php";
try {
    $gt = new Gtranslate();
    echo "Translating [Hello World] from English to German => " . $gt->english_to_german("hello world") . "<br/>";
    echo "Translating [Ciao mondo] Italian to English => " . $gt->it_to_en("Ciao mondo") . "<br/>";
} catch (GTranslateException $ge) {
    echo $ge->getMessage();
}
Example #2
0
<?php 
echo "test";
require "GTranslate.php";
/**
* Example using RequestHTTP
*/
$translate_string = "Das ist wundersch?n";
$test = "우리";
try {
    $gt = new Gtranslate();
    echo "[HTTP] Translating Korean to English => " . $gt->ko_to_en($test) . "\n";
    echo $gt->it_to_en("Ciao mondo");
} catch (GTranslateException $ge) {
    echo $ge->getMessage();
}
Example #3
0
// Output the data
// SimpleXML returns the data as a SimpleXML object
//get channel -> item

$channel = $phpobject->channel;

if(count($channel->item) == 0)
{
	die('<item><title>검색 결과가 없습니다.</title><thumbnail></thumbnail><director></director><homepage></homepage></item>');
}

foreach($channel->item as $value) 
{
    echo "<item>";
    echo "<title>".$gt->it_to_en(htmlspecialchars($value->title->content))."</title>";
    echo "<thumbnail>".htmlspecialchars($value->thumbnail->content)."</thumbnail>";
    echo "<director>".htmlspecialchars($value->director->content)."</director>";
    if($value->homepage->link != "")
    {
    	if(substr($value->homepage->link, 0 , 4) != "http")
    	{
		    echo "<homepage>http://".htmlspecialchars($value->homepage->link)."</homepage>";    	
		}
		else
		{
		    echo "<homepage>".htmlspecialchars($value->homepage->link)."</homepage>";		
		}
    }
    else
    {