cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Need some help

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Sun, 10 Dec 2006 07:09:02 -0600

On 12/10/06, Hai Dao Le <daolehai_at_nm.gist.ac.kr> wrote:
>
> I am using the following simple example of curl
>
>
>
> void get_page ()
>
> {
>
> CURL *curl;
>
> CURLcode res;
>
>
>
> curl = curl_easy_init();
>
> if(curl) {
>
> curl_easy_setopt(curl, CURLOPT_URL, "my_webpage");
>
> res = curl_easy_perform(curl);
>
>
>
> /* always cleanup */
>
> curl_easy_cleanup(curl);
>
> }
>
> }
>
> It's running well and I can see the content of my_webpage. My target now is
> to convert and return this content into a vector of strings (each line is a
> string) for later use. However, I am a beginner and the structure of CURL
> data is quite complicated to me. Is there anybody can help me?

Take a look at getinmemory.c in the examples directory of the source, eg here:

     curl-7.16.0/docs/examples/getinmemory.c

It's a mostly working example of how to fetch a page, using a callback
procedure to store the page in memory. Once you have that you can
process the memory chunk however you please without involving curl.

Ralph Mitchell
Received on 2006-12-10