CURLE_RECV_ERROR with PayPal API CURLE_RECV_ERROR with PayPal API curl curl

CURLE_RECV_ERROR with PayPal API


First, the key to further debugging those issues is to use curl's debugging facilities, namely the VERBOSE setting (and also, possibly, the DEBUGFUNCTION setting for printing the data your way).

c # set_verbose true ;

This identified the error as being a problem with GnuTLS that is also discussed here, and which is solved by setting SSLVERSION to 3 to force the use of SSLv3.

c # set_sslversion 3 ;


I always call curl#set_postfieldsize to the length of the data passed to curl#set_postfields. My code would be, then:

let make_get url =  let curl = new Curl.handle in  curl#set_writefunction String.length; (* ignore result *)  curl#set_tcpnodelay true;  curl#set_verbose false;  curl#set_post false;  curl#set_url url;  curllet make_post url =  let curl = make_get url in  curl#set_post true;  curl#set_httpheader [  "Content-Type: text/xml; charset=\"UTF-8\"";  "SOAPAction: \"\"";  ];  curl#set_postfields xml;  curl#set_postfieldsize (String.length xml);  curl

I hope this helps.