cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Using Libcurl to recieve an HTML page

From: <man_at_tfhs.net>
Date: Sat, 16 Jul 2005 20:59:14 -0000

On Sat, Jul 16, 2005, Sue Stones <cyberstones_at_gmail.com> said:

> I am trying to use libcurl to get information from a webpage, that
> informations will be used by my application. I retrieve the page and
> then pass it down a pipe so that it is not lost to stdout.
>
> The problem I am having is that since curl does not retrieve the EOF
> the transaction never finishes, easy_curl_cleanup is never called, the
> pipe never terminates and the process reading the other end of the
> pipe enters a perpetual loop.
>
> How can I terminate the call?
>
> I have read everything that I can find that might show how to use
> this, and have been going round in circles for days.

sue- are you using your own callback, or are you letting libcurl's default
(print to stdout) run things for you?

something like this:
curl_easy_setopt(mycurl, CURLOPT_WRITEFUNCTION, httpWriteCallback)
curl_easy_setopt(mycurl, CURLOPT_WRITEDATA, (void *)fd)

you will have to write httpWriteCallback() yourself, but it should be
possible to have it print the data to your pipe and return the size of the
data it printed. when that size comes up to the total size libcurl got
from the server, curl_easy_perform will return. then you can write an EOF
out the same pipe the callback used.

i think :)

allan

>
> thanks
>
> sue
>
>

-- 
Received on 2005-07-16