cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Problem with GET

From: James Dennett <jdennett_at_technocom-wireless.com>
Date: Wed, 18 Jul 2007 16:46:23 -0700

> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se [mailto:curl-library-
> bounces_at_cool.haxx.se] On Behalf Of James Woo
> Sent: Wednesday, July 18, 2007 4:17 PM
> To: libcurl development
> Subject: Re: Problem with GET
>
> Dan Fandrich wrote:
> > On Wed, Jul 18, 2007 at 03:58:56PM -0700, James Woo wrote:
> >
> >> I'm new to libcurl. After using curl_easy_setopt (ctx,
> >> CURLOPT_WRITEFUNCTION, write_callback) to
> >> retrieve the web page. I would like to send a http "GET" message
with
> the
> >> info from the web page.
> >> I tried curl_easy_setopt(ctx, CURLOPT_READFUNCTION, read_callback)
to
> send
> >> the http message.
> >> But the read_callback function is never called. What did I do wrong
> here?
> >>
> >
> > How are you retrieving the original web page. With a "GET" request,
most
> > likely. You can read the next web page in exactly the same manner.
You
> > will need to ensure that the URL contains any necessary parameters
you
> > retrieved from the first web page.
> >
> >
> curl_global_init(CURL_GLOBAL_ALL);
> ctx = curl_easy_init();
> curl_easy_setopt (ctx, CURLOPT_WRITEFUNCTION, write_callback);
> curl_easy_setopt (ctx, CURLOPT_URL, "http://172.30.2.164/xxx/yyy/");
> curl_easy_perform (ctx);
>
> Got my first web page in the write_callback function.
>
> curl_easy_setopt (ctx, CURLOPT_READFUNCTION, read_callback);
> curl_easy_perform (ctx);
>
> Nothing happened.

I'm confused. What is it that you expect your read_callback function to
do? What is the second operation you're trying to perform? If it's an
HTTP GET then there's no local reading to do.

-- James
Received on 2007-07-19