PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Rafael Martin Soto   GoogleTrnsltr PHP Google Translate API Library   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: GoogleTrnsltr PHP Google Translate API Library
Translate texts between languages using Google API
Author: By
Last change:
Date: 1 year ago
Size: 850 bytes
 

Contents

Class file image Download
<?php
/**
 * EXAMPLE FILE OF CLASS GoogleTrnsltr
 *
 * BEWARE: Google Translator API is a PAYMENT Service of Google
 *
 * Source code donated by bio-farma.es
 *
 * @author Rafael Martin Soto
 * @author {@link https://www.inatica.com/ Inatica}
 * @link https://bio-farma.es/
 * @link https://rafamartin10.blogspot.com/
 * @since December 2021
 * @version 1.0.0
 * @license GNU General Public License v3.0
 */
  

 
include __DIR__ . '/GoogleTrnsltr.class.php';

 
// IMPORTANT!!!! Change next string with you GOOGLE TRANSLATOR KEY
 
$GoogleTrnsltr = new GoogleTrnsltr( 'IMPORTANT_CHANGE_HERE-YOUR-GOOGLE-TRANSLATOR-API-KEY' ); // See https://cloud.google.com/translate/docs/setup
 
echo $GoogleTrnsltr->tnrltSrcTgt( 'Hello World!', 'en', 'es' ); // Echo { "data": { "translations": [ { "translatedText": "Hola Mundo!" } ] } }
?>