In the R code making requests to our API there was no usage of proxies which is likely to be the source of errors.
Anyway, rather than keep conjecturing we may understand the problem by simply reading the reply to the requests since the problem is in "parsing" the value of getForm(nex, .params=params, .checkParams = TRUE, .opts = mycurlopts) which is not a valid Json.
So I kindly ask to modify dataTxtSent in the following way:
dataTxtSent <- function(input, app_id, app_key, language='auto') {
nex <- 'https://api.dandelion.eu/datatxt/sent/v1'
params <- list()
params['$app_id'] <- app_id
params['$app_key'] <- app_key
if (grepl("^https?://", input)){
params['url'] <- input
} else {
params['text'] <- input
}
params['lang'] <- language
cert <- system.file("CurlSSL/cacert.pem", package = "RCurl")
appReply <- getForm(nex, .params=params, .checkParams = TRUE, .opts = mycurlopts)
return(appReply)
}
then let it run:
results <- dataTxtSent(input='Oggi il tempo fa schifo', app_id, app_key, language = 'auto')
and then share with us the value of "result".
Kind regards,
Nicola
You can see that by using any convert from hexadecimal to string: for example you can copy and paste the value of the result (removing the line marks) in http://software.hixie.ch/utilities/cgi/unicode-decoder/utf8-decoder and select Hexadecimal from the drop-down menu: you'll then read:
As raw characters:
{"time":0,"sentiment":{"type":"negative","score":-0.8},"lang":"it","langConfidence":1.0,"timestamp":"2015-07-28T14:06:57.591"}
May I know which version for R and RCurl you're currently using? (Mine are: 3.1.3 and RCurl 1.95-4.5).