API does not work

Hello,
I’m trying to use the API with french language using the documentation. But when I hit the “check text” button, it does not color the errors… And I get in the console :

Here are my index.php code :

<script language="javascript" type="text/javascript">  
  tinyMCE.init({
	 mode : "textareas",
	 plugins : "AtD,paste",
	 paste_text_sticky : true,
	 setup : function(ed) {
		 ed.onInit.add(function(ed) {
			 ed.pasteAsPlainText = true;
		 });
	 },  
	 /* translations: */
	 languagetool_i18n_no_errors : {
		 // "No errors were found.":
		 "fr": "Keine Fehler gefunden."
	 },
	 languagetool_i18n_explain : {
		 // "Explain..." - shown if there is an URL with a detailed description:
		 "fr": "Mehr Informationen..."
	 },
	 languagetool_i18n_ignore_once : {
		 // "Ignore this error":
		 "fr": "Hier ignorieren"
	 },
	 languagetool_i18n_ignore_all : {
		 // "Ignore this kind of error":
		 "fr": "Fehler dieses Typs ignorieren"
	 },
	 languagetool_i18n_rule_implementation : {
		 // "Rule implementation":
		 "fr": "Implementierung der Regel"
	 },
 
	 languagetool_i18n_current_lang :
		 function() { return document.checkform.lang.value; },
	 /* the URL of your proxy file - must be hosted on your domain: */
	 languagetool_rpc_url : "proxy.php",
	 /* edit this file to customize how LanguageTool shows errors: */
	 languagetool_css_url :
		 "http://www.languagetool.org/online-check/" +
		 "tiny_mce/plugins/atd-tinymce/css/content.css",
	 /* this stuff is a matter of preference: */
	 theme                              : "advanced",
	 theme_advanced_buttons1            : "",
	 theme_advanced_buttons2            : "",
	 theme_advanced_buttons3            : "",
	 theme_advanced_toolbar_location    : "none",
	 theme_advanced_toolbar_align       : "left",
	 theme_advanced_statusbar_location  : "bottom",
	 theme_advanced_path                : false,
	 theme_advanced_resizing            : true,
	 theme_advanced_resizing_use_cookie : false,
	 gecko_spellcheck                   : false
  });
 
  function doit() {
	 var langCode = document.checkform.lang.value;
	 tinyMCE.activeEditor.execCommand("mceWritingImprovementTool", langCode);
  }
</script>

Paste your own text here... or check check this text.

Français

And I copied/pasted the proxy.php file.

Do you know what’s wrong?
Many thanks for your help.

This might have been a problem in our script that you include. Could you clean your browser cache and try again?

I just did it and I get the same problem, no return of the errors…

Could you post the URL so I can have a look?

I’m working in local with Wamp. But if you want I can just send you the files but with the code I pasted in this thread and the proxy.php you have it all :wink:

The code of my index.php is very basic, it’s just to check if it works right now.

Sorry, setting up the files locally would take too long and maybe it would work for me. If you can upload the files so the issue can be reproduced online, I could have a look.

Here it is : http://www.lalanguefrancaise.com/dictee/

Many thanks for your help :wink:

The proxy.php returns a 500 error, you’ll need to debug that first, e.g. by looking in the server’s log for warnings and errors or by adding “print” statements every second line to see where the issue is.

Yes, I got this : “PHP Parse error: syntax error, unexpected ‘finally’ (T_STRING), expecting catch (T_CATCH) in /home/lalangue/public_html/dictee/proxy.php on line 43”

I tried to change to catch but after the error is on the “{” on line 43… I’m not very used to manage PHP, do you know what’s the error in the proxy.php code?

Please try this version: https://raw.githubusercontent.com/languagetool-org/languagetool-website/f8d2a4567b6af43db287967534b0c10f2e26c828/www/online-check/tiny_mce/plugins/atd-tinymce/server/proxy.php

It works ! The error was with the try, catch, finally statement. Thanks a lot for your help !