Anteriormente los hacíamos así:
Code: Select all | Expand
ohttp := CreateObject( "MSXML2.XMLHTTP" )
ohttp:Open( "POST" , ::urlenvio ,.F.)
oHttp:SetRequestHeader("cache-control", "no-cache")
ohttp:SetRequestHeader("content-type", "application/json" )
ohttp:SetRequestHeader("authorization", "Basic "+cBas64 )
TRY
ohttp:Send( ::cdnaJson )
response := ohttp:responseText
CATCH oError
cError := "Error: " + cValToChar( oError:GenCode) + ;
" SubC: " + cValToChar( oError:GenCode) + " OSCode: " + cValToChar( oError:GenCode) + CRLF + ;
"SubSystem: " + cValToChar( oError:SubSystem ) + CRLF + "Envio de CURL: " + oError:Description
exito := {.f.,cError}
return exito
END
Ahora que estamos usando curl, _ el error, pero no sabemos como, aquí el código:
Code: Select all | Expand
AADD(aHeader,"Authorization: Basic "+cBas64 )
AADD(aHeader,"Content-Type: application/json")
AADD(aHeader,"cache-control: no-cache")
oCurl = curl_easy_init()
curl_easy_setopt( oCurl, HB_CURLOPT_URL, ::urlenvio )
curl_easy_setopt( oCurl, HB_CURLOPT_DL_BUFF_SETUP )
curl_easy_setopt( oCurl, HB_CURLOPT_SSL_VERIFYPEER, 0 )
curl_easy_setopt( oCurl, HB_CURLOPT_POSTFIELDS, ::cdnaJson )
curl_easy_setopt( oCurl, HB_CURLOPT_CUSTOMREQUEST , "POST")
curl_easy_setopt( oCurl, HB_CURLOPT_HTTPHEADER, aHeader )
IF CURL_EASY_PERFORM( oCurl ) == 0
response = curl_easy_dl_buff_get( oCurl )
ENDIF
curl_easy_cleanup( oCurl )
De antemano gracias si alguien nos puede ayudar.