开发者

Is there in C API for PHP's CURLOPT_RETURNTRANSFER?

开发者 https://www.devze.com 2023-03-21 10:24 出处:网络
In PHP API we couldus开发者_StackOverflowe curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); but how to translate it into C? I tried curl_easy_setopt(curl_handle, CURLOPT_RETURNTRANSFER, true); but fa

In PHP API we could us开发者_StackOverflowe curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); but how to translate it into C? I tried curl_easy_setopt(curl_handle, CURLOPT_RETURNTRANSFER, true); but failed.


There's no CURLOPT_RETURNTRANSFER in libcurl C API. You can do that with a callback function, it's one of libcurls examples: get a remote file in memory only.


I think this mailing list entry is relevant:

http://curl.haxx.se/mail/curlphp-2009-11/0005.html

CURLOPT_RETURNTRANSFER was invented by the PHP binding author and is basically just a shortcut for appending all received data into a memory buffer. With the C API and basically all existing bindings as well (including the PHP one) you can use a write callback to append all data to a single buffer.

0

精彩评论

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