cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: retrieving complete response using curl_exec()

From: Brian Wilkins <brian_at_hcc.net>
Date: Sat, 5 Feb 2005 23:10:14 +0500

>
> <snip example of using CURLOPT_WRITEFUNCTION>
>
> I like that, but I'm not sure what gets you over the
> CURLOPT_RETURNTRANSFER method. What's your rationale for using this
> method instead?
>
> Michael

CURLOPT_RETURNTRANSFER will not return the results of the cURL query except
in the contents that are returned in the curl_exec() method. If you do not
use CURLOPT_RETURNTRANSFER set to 1, you will have to use some sort of
method, like I have shown, to get the cURL query and $string = curl_exec()
will return true/false (I believe). I have no need to use
CURLOPT_RETURNTRANSFER since the aforementioned procedure works just fine
for me and there is no perceived performance hit by using that method.

As far as rationale, there really was none. Part of it is laziness, I was
not aware of the CURLOPT_RETURNTRANSFER when I first wrote my program, but I
recently stumbled upon it. It's too tedious to convert all my code and test
it. Therefore, I heed the credo : "Don't fix it, unless it is broken" :)
Received on 2005-02-06