简体   繁体   中英

Is there in C API for PHP's CURLOPT_RETURNTRANSFER?

In PHP API we could use 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM