cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Storing curl_easy_perform in variable

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Mon, 5 Jun 2006 18:02:08 -0500

Look for "getinmemory.c" in the examples directory of the source tar file.
That shows you exactly how to save a web page into a chunk of memory. You'd
then need to hack off the extra fluff wrapped around the IP address.

Ralph Mitchell

On 6/4/06, Sheldon Neuberger <neuberger_at_gmail.com> wrote:
>
> Hello,
>
> I am new to libcurl and I am trying to retrieve an IP address from
> whatismyip.org. I want to then store that IP address in a string. I have
> the following chunk of code
>
> CURL *curl;
> CURLcode res;
>
> curl = curl_easy_init();
> if(curl) {
> curl_easy_setopt(curl, CURLOPT_URL, "whatismyip.org");
> res = curl_easy_perform(curl);
>
>
> curl_easy_cleanup(curl);
> }
> return 0;
>
>
> However, I do now know how to store the stuff retrieved from the page into
> a variable. Thanks in advance for any help.
>
Received on 2006-06-06