I would recommend using languagelayer.com , they offer a free RESTful JSON API web service that can detect about 170 languages. Batch requests are also offered.
The GET API request (POST welcomed) looks something like this:
https:
And here is the JSON answer:
{ "success": true, "results": [ { "language_code": "en", "language_name": "English", "probability": 83.896703655741, "percentage": 100, "reliable_result": true } ] }
5,000 monthly requests are free, if you need more (like I did), then the cheapest subscription is $ 4.99 per month for 50,000 requests. (More info here )
Frank source share