<?php
/*
example usage
languageLayer ver 1.0
You must get an API key from https://languagelayer.com/product
and enter it in the langlayer.class.php file
*/
//turning off low level notices
error_reporting(E_ALL ^ E_NOTICE);
//text to test
$text = 'Ich bin mir sicher, dass dies die Sprache Deutsch';
//instantiate the class
include('langlayer.class.php');
$lang = new languageLayer();
//get the response from the api
$lang->getResponse($text);
//check for reported error
if( $lang->errorCode ){
die('error ('.$lang->errorCode.'): '.$lang->errorText);
}
//show the response object
var_dump($lang->response);
?>
|