Back to LanguageTool Homepage - Privacy - Imprint

Error: problem communicating with the service


(Kuldeep) #1

Hello Friends,

I am new to LanguageTool. I try to set-up LanguageTool to my local machine(WAMP). And I am getting this error.

Error: There was a problem communicating with the service. Try again in one minute.

Thank You
Kuldeep


(Daniel Naber) #2

Does http://localhost:8081/?language=en&text=my+text work ? How do you access the service, via a proxy?


(Kuldeep) #3

Hi there,

thanks for fast reply. No this 'http://localhost:8081/?language=en&text=my+text' is not working. I did not understand your second question. I access "https://languagetool.org" using curl code.

Thank You
Kuldeep


(Daniel Naber) #4

So are you trying to run your own instance of LanguageTool that you want to use, or do you want to use our public service? The latter is described here:

http://wiki.languagetool.org/public-http-api

What code exactly are you using?


(Kuldeep) #5

I downloaded 'languagetool-websiteI(https://github.com/languagetool-org/languagetool-website)' website code from GitHub. And I am trying run that website code. Currently I want run that code but in future I will use your public service.

Most of website code is php.

This is the code from proxy.php.
##############################################
// LanguageTool Proxy Script
// requires curl for PHP - on Ubuntu, install with "sudo apt-get install php5-curl"
error_reporting(E_ALL);
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$postText = trim(file_get_contents('php://input'));
$postText = html_entity_decode($postText, ENT_COMPAT, "UTF-8");

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://languagetool.org");

curl_setopt($curl, CURLOPT_PORT, 8081);

curl_setopt($curl, CURLOPT_SSLVERSION, 3);

curl_setopt($curl, CURLOPT_POST, true);

curl_setopt($curl, CURLOPT_POSTFIELDS, $postText);

curl_setopt($curl, CURLOPT_HEADER, 0);

curl_setopt($curl, CURLOPT_REFERER, $SERVER['HTTPREFERER']);

header("Content-Type: text/xml; charset=utf-8");
//for debugging:
//header("Content-Type: text/plain");

curl_exec($curl);

curl_close($curl);
} else {
print "Error: this proxy only supports POST";
}
########################################

Thank you
Kuldeep


(Daniel Naber) #6

It's probably some PHP problem which you need to debug, e.g. by trying proxy.php directly, making sure that your PHP has support for curl etc.