[英]Is there in C API for PHP's CURLOPT_RETURNTRANSFER?
In PHP API we could use curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
在 PHP API 中,我们可以使用
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
but how to translate it into C?但如何将其翻译成 C? I tried
curl_easy_setopt(curl_handle, CURLOPT_RETURNTRANSFER, true);
我试过
curl_easy_setopt(curl_handle, CURLOPT_RETURNTRANSFER, true);
but failed.但失败了。
There's no CURLOPT_RETURNTRANSFER
in libcurl C API. libcurl C API 中没有
CURLOPT_RETURNTRANSFER
。 You can do that with a callback function, it's one of libcurls examples : get a remote file in memory only .您可以通过回调 function 来做到这一点,它是libcurls 示例之一:仅在 memory 中获取远程文件。
I think this mailing list entry is relevant:我认为这个邮件列表条目是相关的:
http://curl.haxx.se/mail/curlphp-2009-11/0005.html 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.
CURLOPT_RETURNTRANSFER 由 PHP 绑定作者发明,基本上只是将所有接收到的数据附加到 memory 缓冲区的快捷方式。 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.
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.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.