cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_POST is not returning anything

From: Isaac Sanni-Thomas <isaacsannithomas_at_gmail.com>
Date: Fri, 11 Dec 2009 09:46:07 +0000

On 12/11/2009 09:19 AM, nitin.mittal_at_rsa.com wrote:
> Thanks for your reply.
>
> I ave removed CURLOPT_POSTFIELDS& kept only CURLOPT_READFUNCTION.
>
> But even then I am not getting any response from the server.
>
> I want read_callback to read the respose that will be sent back by the
> server (which I am not getting right now& that's the problem).

So what you want to do is to get the response from the server and
process that response. I write the response to a file and then read back
for some other processing like this:

//All Code in C
curl_easy_setopt(handle, CURLOPT_POSTFIELDS,"PIN=0&data=510000");
curl_easy_setopt(handle, CURLOPT_URL,"http://localhost/sub/test2.php");
FILE * somefile=fopen("somelog.log","w");
curl_easy_setopt(handle,CURLOPT_WRITEDATA,somefile);//server response
curl_easy_perform(handle);

That will write the web server response to the file somelog.log.
 From here I have another line where I read the server response in the
file and process accordingly by my app.
NB://Ensure that your web app works correctly without errors.
Hope this helps.
> I found this read_callback implementation while digging through the
> links on net& pasted it as I found it. I can modify this function later
> but I should get at least some response from the server. I am getting a
> blank screen instead.
>
> I hope you undertstand the problem now.
>
> Thanks& Regards,
> Nitin Mittal
> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se
> [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Daniel Stenberg
> Sent: Friday, December 11, 2009 2:20 PM
> To: libcurl development
> Subject: Re: CURLOPT_POST is not returning anything
>
> On Thu, 10 Dec 2009, nitin.mittal_at_rsa.com wrote:
>
>> I am able to connect to the remote server but in return I am just
> getting
>> the blank screen. I expect the server to send some response.
>>
>> Am I missing any libcurl call or anything?
>
> I suggest starting out with an example code and go from there.
>
> You use both read callback and postfields, what exactly do you want the
> read
> callback for and if you want it, why do you make it read only one byte
> at a
> time?
>
>
>
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-12-11