solr 将命令行cURL转换为C cURL

mu0hgdu0  于 9个月前  发布在  Solr
关注(0)|答案(2)|浏览(156)

我从来没有做过任何Curl之前,所以我在需要一些帮助。我试图工作,这从例子,但不能得到我的头周围!
我有一个curl命令,我可以成功地从Windows命令行运行,索引PDF文件在Solr
我需要将此curl命令合并到C客户端中。
如何翻译这个Curl命令,使其在C Curl client中工作?

curl "http://localhost:8983/solr/update/extract?literal.id=doc2&uprefix=attr_&fmap.content=attr_content&commit=true"" -F "[email protected]"

字符串

pgpifvop

pgpifvop1#

在FOSDEM 2015上,curl的作者丹尼尔·斯滕伯格(Daniel Stenberg)向我展示了一个使用libcurl选项的好例子:

curl http://example.com --libcurl example.c

字符串
正如你可以猜到的,你可以在example. c中找到完整的代码(包括处理程序和清理)。

kpbpu008

kpbpu0082#

STARTUPINFO si = { sizeof(STARTUPINFO) };
PROCESS_INFORMATION pi;
TCHAR tempCmdLine[MAX_PATH];
_tcscpy_s(tempCmdLine, MAX_PATH, _T("curl.exe http://localhost:8983/solr/update/extract?literal.id=doc2&uprefix=attr_&fmap.content=attr_content&commit=true -F [email protected]"));
CreateProcess(NULL, tempCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);

字符串
您可能需要检查CreateProcess的返回值。

相关问题