cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Get the source code of a web page

From: James Buchanan <software.au_at_gmail.com>
Date: Wed, 22 Nov 2006 17:55:38 +1100

On 11/22/06, Ralph Mitchell <ralphmitchell_at_gmail.com> wrote:
> On 11/21/06, 1 # <dollarmannen_at_hotmail.com> wrote:
> > Hello.
> > I want to make a project that gets the source code of a specified web page
> > and store it in a string. I couldnt find any information on the net about
> > this.
>
> Check the source for a sample program called getinmemory.c

Yes, that's an excellent and very simple example. It can be modified
to replace the fetching of the curl page (where you specify the URL
with CURLOPT_URL) using argv[1], so the program runs like:

getinmemory.exe http://www.whatever.com/page.html

and further modified to ask the user if they want to display the page
on the console window and/or write it out to a file after calling
curl_easy_perform.

That would be a good starting point for your own program to get a web
page and store it in a string for whatever purpose.

-J
Received on 2006-11-22