News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPRiot.com:
Translating Text Using the Google Translate API and PHP, JSON and cURL
May 06, 2011 @ 08:45:04

On PHPRiot.com there's a new tutorial showing you how to use the Google Translate service to translate the text of your website into any language they support. They interface with it using a cURL connection and JSON messaging.

Google Translate is a service from Google that you can use to translate text or HTML from one language to another. One of the great features of this service is that they now offer an API to let you programmatically translate text. In this article I will show you how to interact with the Google Translate API. Initially, the Google Translate API was available only via JavaScript. This has now changed, as version 2 offers a REST interface which returns translations in JSON format.

They talk about the input parameters you can give the service, the enforcement of query limits and how to handle the results that are returned. The response message is, by default, in JSON so a simple call to json_decode should be all that's needed. They've also included a sample class you can drop in and use for your translation needs (as well as sample usage code).

0 comments voice your opinion now!
google translate api json curl tutorial language


blog comments powered by Disqus

Similar Posts

Matthew Weier O'Phinney's Blog: Pastebin app updates

PHP-Coding-Practices.com: Composing Methods: Split Temporary Variable

SitePoint.com: How to Create an XML to JSON Proxy Server in PHP

Developer Tutorials: Introduction to PHP Programming

Community News: IPC10 PHP: Yesterdays Scala and the Cobol of tomorrow? (video)


Community Events





Don't see your event here?
Let us know!


list zendserver threedevsandamaybe deployment release code bugfix podcast framework conference laravel tips api language series community interview introduction voicesoftheelephpant symfony

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework