Hello everyone.
I would like to know how to reproduce this code on the line where it is:
CURLOPT_POSTFIELDS => array('username' => 'myUsername','password' => 'myPassword*'),
I don't know how to send the data type as an array in this situation. Could you help me?
I use hb_curl.lib to use CURL commands.
in FiveWin:
curlHandle := curl_easy_init()
curl_easy_setopt( curlHandle, HB_CURLOPT_URL, 'https://server.by.test.xxx')
curl_easy_setopt( curlHandle, HB_CURLOPT_DOWNLOAD )
curl_easy_setopt( curlHandle, HB_CURLOPT_DL_BUFF_SETUP )
curl_easy_setopt( curlHandle, HB_CURLOPT_ENCODING, '')
curl_easy_setopt( curlHandle, HB_CURLOPT_MAXREDIRS, 10)
curl_easy_setopt( curlHandle, HB_CURLOPT_TIMEOUT, 0)
curl_easy_setopt( curlHandle, HB_CURLOPT_FOLLOWLOCATION, 1)
curl_easy_setopt( curlHandle, HB_CURLOPT_HTTP_VERSION, 2)
curl_easy_setopt(curlHandle, HB_CURLOPT_POST, 1)
curl_easy_setopt( curlHandle, HB_CURLOPT_CUSTOMREQUEST, 'POST')
curl_easy_setopt( curlHandle, HB_CURLOPT_POSTFIELDS, 'username' => 'myUsername','password' => 'myPassword*')
cc1 := curl_easy_dl_buff_get( curlHandle )
nStatusCurl = curl_easy_getinfo(curlHandle, HB_CURLINFO_RESPONSE_CODE)
?nStatusCurl,strtran( htmltoansi( cc1 ), """, '"' )
//return received:
// 403, empty_username
in PHP:
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://server.by.test.xxx',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('username' => 'myUsername','password' => 'myPassword*'),
));
//return received:
// 200, sucess
in CURL:
curl --location --request POST 'https://server.by.test.xxx' \
--form 'username="myUsername"' \
--form 'password="myPassword"'
How to use hb_curl
Return to “FiveWin for Harbour/xHarbour”
Jump to
- English Forums
- ↳ FiveWin for CA-Clipper
- ↳ FiveWin for Harbour/xHarbour
- ↳ FiveTouch
- ↳ EasyReport, EasyDialog and EasyPreview
- ↳ FiveMac / FivePhone (iPhone, iPad)
- ↳ FiveLinux / FiveDroid (Android)
- ↳ FiveWin for Pocket PC
- ↳ mod_harbour
- Foros en Español
- ↳ FiveWin para CA-Clipper
- ↳ FiveWin para Harbour/xHarbour
- ↳ FiveTouch
- ↳ EasyReport, EasyDialog y EasyPreview
- ↳ FiveMac / FivePhone (iPhone, iPad)
- ↳ FiveLinux / FiveDroid (Android)
- ↳ FiveWin para Pocket PC
- ↳ mod_harbour
- Forum italiani
- ↳ All products support
- Forum Portuguese
- ↳ All products support
- Forum German
- ↳ All products support
- General
- ↳ WhatsNew / Novedades
- ↳ Bugs report & fixes / Informe de errores y arreglos
- ↳ To do - WishList / Por hacer - Peticiones
- ↳ Utilities / Utilidades
- ↳ Off Topic / Otros temas
- Artificial Intelligence
- ↳ TensorFlow and Python examples
- ↳ TensorFlow.dll for Harbour and FWH
- ↳ latest AI news
- ↳ Building TensorFlow.dll
- ↳ AI Introduction (Harbour code and samples)