- выгрузка файлов с сервера
- загрузка файлов на сервер
- HTTP GET/POST с возможностью прочитать ответ сервера
- Поддержка SSL
Тестировал на протоколах http, https, ftp, sftp, ftpes.
Краткий туториал в файле \doc\How-To.txt.
Модератор: Дед Пахом
К сожалению, функция curl_easy_strerror(CURLcode errcode) жёстко возвращает ошибки на английском.
Вряд ли это libcurl виноват, ни в одном файле нет упоминания о MessageBox.
Единственное, что можно предложить, это вызвать curl.exe с нужными параметрами плюс опция --libcurl FILE, и получить код на C с нужными вызовами, а затем перевести это в код на Clarion, например (вызов из проводника):
Код: Выделить всё
curl -k -i -H "HTML/xml" -X POST -d "username=pan&password=Vfh" https://mail.ru/login --libcurl test.c
Код: Выделить всё
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
struct curl_slist *slist1;
slist1 = NULL;
slist1 = curl_slist_append(slist1, "HTML/xml");
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_URL, "https://mail.ru/login");
curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "username=pan&password=Vfh");
curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)25);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/7.40.0");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist1);
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(hnd, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may select to either not use them or implement
them yourself.
CURLOPT_WRITEDATA set to a objectpointer
CURLOPT_WRITEFUNCTION set to a functionpointer
CURLOPT_READDATA set to a objectpointer
CURLOPT_READFUNCTION set to a functionpointer
CURLOPT_SEEKDATA set to a objectpointer
CURLOPT_SEEKFUNCTION set to a functionpointer
CURLOPT_ERRORBUFFER set to a objectpointer
CURLOPT_STDERR set to a objectpointer
CURLOPT_HEADERFUNCTION set to a functionpointer
CURLOPT_HEADERDATA set to a objectpointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
curl_slist_free_all(slist1);
slist1 = NULL;
return (int)ret;
}
/**** End of sample code ****/