googletest.php
PHP Code:
<?php
echo "Starting translation test G API V1<br/>\n";
$connection = curl_init();
curl_setopt($connection, CURLOPT_URL, 'http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&format=html&langpair=en|pl&q=welcome');
curl_setopt($connection, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)');
//curl_setopt($connection, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($connection);
echo 'Test result: '.$result."<br/>\n";
echo 'Test error: '.curl_error($connection)."<br/>\n";
curl_close($connection);
?>
开始翻译测试摹的API V1
测试结果:{“responseData”,“responseDetails”:“怀疑滥用服务条款请参阅http://code.google.com/apis/errors”,“responseStatus”:403}
测试错误:
googletest.php
PHP Code:
<?php
echo "Starting translation test<br/>\n";
$connection = curl_init();
curl_setopt($connection, CURLOPT_URL, 'http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&format=html&langpair=en|pl&q=welcome');
curl_setopt($connection, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)');
curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
$time = microtime(true) * 1000;
$result = curl_exec($connection);
$time = microtime(true) * 1000 - $time;
echo 'Test result: '.$result."<br/>\n";
echo 'Test error: '.curl_error($connection)."<br/>\n";
curl_close($connection);
echo 'Connection time (ms): '.$time;
?>
开始翻译测试
测试结果:{“responseData”:{“translatedText”:“powitanie”},“responseDetails”空“,responseStatus”:200}
测试错误:
连接的时间 (毫秒): 148.76098632812
-