Tentei portar o código PHP para Harbour usando cUrl.
Código: Selecionar todos
cr := curl_easy_init()
curl_easy_setopt(cr, HB_CURLOPT_URL, cURL)
//definindo a url de busca
curl_easy_setopt(cr, HB_CURLOPT_RETURNTRANSFER, .t.)
//definino que o método de envio, será POST
curl_easy_setopt(cr, HB_CURLOPT_POST, .t.)
//definindo os dados que serão enviados
curl_easy_setopt(cr, HB_CURLOPT_POSTFIELDS, Lista)
curl_easy_setopt(cr, HB_CURLOPT_HTTPHEADER, array("Accept: application/json","content-type", "multipart/form-data"))
cStr = curl_easy_perform( cr )
curl_easy_reset( cr )
curl_easy_cleanup( cr )
Porem não consigo compilar. Embora conste no harbour as funções instaladas não reconhece.
hbmk2 -find curl
hbcurl.hbc (instalado):
curl_easy_cleanup()
curl_easy_dl_buff_get()
curl_easy_duplicate()
curl_easy_escape()
curl_easy_getinfo()
curl_easy_init()
curl_easy_pause()
curl_easy_perform()
curl_easy_recv()
curl_easy_reset()
curl_easy_send()
curl_easy_setopt()
curl_easy_strerror()
curl_easy_unescape()
curl_escape()
curl_getdate()
curl_global_cleanup()
curl_global_init()
curl_unescape()
curl_version()
curl_version_info()
__HBEXTERN__HBCURL__()
Ao compilar da a sugestão
hbmk2: Dica: Adicionar opçπo 'hbcurl.hbc' faltando nas funç⌡es:
curl_global_cleanup(), curl_easy_cleanup(), curl_easy_reset(),
curl_easy_perform(), curl_easy_setopt(), curl_easy_init()
Ao colocar na compilação o hbcurl.hbc da falta da lib
hbmk2: Linkando... monitorPARCEIRO-IFOOD.exe
e:/hb32/comp/mingw/bin/../lib/gcc/mingw32/4.6.1-dw2/../../../../mingw32/bin/ld.e
xe: cannot find -llibcurl
collect2: ld returned 1 exit status
hbmk2[junta-IFOOD]: Erro: Executando linkeditor. 1
e:\hb32\comp\mingw\bin\gcc.exe ".hbmk/win/mingw/monitorPARCEIRO-IFOOD.o" .hbmk/w
in/mingw/erroparceiro.o ".hbmk/win/mingw/_hbmkaut_monitorPARCEIRO-IFOOD.o" -m
windows -Wl,--start-group -lgtwvg -lhbwin -lpng -lhbcurl -llibcurl -lhbct -lhbti
p -lhbxpp -lhbextern -lhbdebug -lhbvm -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca
-lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx
-lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon
-lhbmainwin -lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -liphlpapi -lwinspoo
l -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm -lmapi
32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib -Wl,--end-group -s -o"monitor
PARCEIRO-IFOOD.exe" -Le:/hb32/lib/win/mingw
Na minha pasta \hb32\lib\win\mingw constam
-libhbcurl.a
-libhbcurls.a
más não reconhecem.