Basically, when I try the equivalent of curl --data 'start=y&icognoid=wsf&fno=0&sub=Say&islearning=1&cleanslate=false&stimulus=!!!%20there%20was%20an%20error%20!!!&icognocheck=af71393ce00d9126a247df2f53948e79' http://www.cleverbot.com/webservicemin/ in em-http-request, it calls fail even though the curl displays the correct response from the server.
Here is the code I had as the equlvaient of the curl:
require 'eventmachine'
require 'em-http-request'
uri = 'http://www.cleverbot.com/webservicemin/'
query = 'start=y&icognoid=wsf&fno=0&sub=Say&islearning=1&cleanslate=false&stimulus=!!!%20there%20was%20an%20error%20!!!&icognocheck=af71393ce00d9126a247df2f53948e79'
EM.run do
http = EM::HttpRequest.new(uri).post(query: query)
http.callback { puts http.response; EM.stop }
http.errback { puts 'There was an error'; EM.stop }
end
http://stackoverflow.com/questions/25164272/simple-post-request-failing-with-em-http-request
Basically, when I try the equivalent of
curl --data 'start=y&icognoid=wsf&fno=0&sub=Say&islearning=1&cleanslate=false&stimulus=!!!%20there%20was%20an%20error%20!!!&icognocheck=af71393ce00d9126a247df2f53948e79' http://www.cleverbot.com/webservicemin/
in em-http-request, it callsfail
even though the curl displays the correct response from the server.Here is the code I had as the equlvaient of the curl:
There was an error
is printed.