Back to LanguageTool Homepage - Privacy - Imprint

Problem with HTTP Service


(HHH) #1

Hi there,

we are using the HTTP Service on our website. We followed the instruction described at http://wiki.languagetool.org/integration-on-websites.

With different browsers we always get following error message: "There was a problem communicating with the service. Try again in one minute."

Right now we are using PHP 5.5. We also tried it with different PHP versions (5.2, 5.3, 5.4) We get always the same error message.

Here you find the HTTP service http://hurraki.de/pruefung/pruefung

any idea? would be appreciated...


(Daniel Naber) #2

Unfortunately, PHP is sometimes difficult to debug. A call like this should return a valid XML document, but that doesn't work:

curl --data "language=de-DE&text=ein+Text" "http://hurraki.de/pruefung/proxy.php?url=/checkDocument"

All I can think of is to add "print" statements to the proxy.php, to see how far it gets.


(HHH) #3

thanks for the quick response. what exactly do you mean by adding "print statements".


(Daniel Naber) #4

Add

print "1";

to every other line of the file, call the curl command (see above) and see how far it gets, i.e. where the printing stops. But maybe your PHP just doesn't have support for curl? You should ask you web hosting company if you're not sure.


(HHH) #5

With a little help we got it to work. (One additional line in proxy.php helped) Since a few weeks the http service doesnt work correct. We didnt change anything.

The browser console gives folloing message:

Firefox:
Cross-Origin-Anfrage blockiert: Die Same-Origin-Regel verbietet, die externe Ressource auf https://www.languagetool.org/fonts/ODelI1aHBYDBqgeIAH2zlBBHWFfxJXS04xYOz0jw624.woff zu lesen. Dies kann gelöst werden, indem die Ressource auf die gleiche Domain geschoben wird oder CORS aktiviert wird. ODelI1aHBYDBqgeIAH2zlBBHWFfxJXS04xYOz0jw624.woff
downloadable font: download failed (font-family: "Source Sans Pro" style:normal weight:normal stretch:normal src index:2): bad URI or cross-site access not allowed

Chromium:
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.


(Daniel Naber) #6

I cannot reproduce that message but I could reproduce that it didn't work. It should be fixed now (try cleaning your browser cache if it doesn't). Sorry for the inconvenience, it was caused by a change I made for which I wasn't aware it could break anything.

BTW, which line did you need to add to proxy.php to make it work?


(HHH) #7

Thank you for your quick help. Everything works fine.

Our web hosting company recommended to add this line to our proxy.php

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);


(Daniel Naber) #8

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false) seems to be okay for your use case, as your site doesn't use HTTPS, but people using HTTPS shouldn't set this option. It basically turns of certificate checking so that the data will still be encrypted, but a man-in-the-middle attack becomes possible.


(HHH) #9

Hi there,

the HTTP Service on our website worked for a long time very good. But since a while the service doesnt work anymore. No error Message. It just happens nothing.

Any idea why that is? How we get the HTTP service to work again?

http://www.hurraki.de/pruefung/pruefung


(Daniel Naber) #10

Please see https://languagetool.org/http-api/migration.php


(HHH) #11

Thank you for your quick help. Updated the code and everything works fine again.