开发者

Can't one read responses from curl handles without having to use temporary files to write responses received?

开发者 https://www.devze.com 2023-02-26 10:10 出处:网络
(Refer http://curl.haxx.se/libcurl/c/curl_easy_setopt.html) Using the C libcurl requires you to set the curl option CURLOPT_WRITEDATA passing in a FILE*. Or else it will simply output the response rec

(Refer http://curl.haxx.se/libcurl/c/curl_easy_setopt.html) Using the C libcurl requires you to set the curl option CURLOPT_WRITEDATA passing in a FILE*. Or else it will simply output the response received to stdout. Seems one is then forced to use temporary files just for reading responses, and there is no way to read response directly into a memory buffer. It looks very sh!tty开发者_JAVA百科 and very hard to believe. Php curl has better interfaces. Is this one should live with while using C libcurl? It gets messier still when using curl multi handles, as we have to use multiple temporary files then. Please clarify before I shoot myself.


This has been asked and answered a millions times before. Here's an example how to do it:

http://curl.haxx.se/libcurl/c/getinmemory.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号