Read document from a given URL

Hi,

I've got a small project work to write a C++ code to read a webpage (any page having any article) and to write it down in a file.

I went through this forum and found a thread "cUrl, how to retreive the contents of a url" where this has been done using cURL. I tried this but getting error (cURL.h: no file or directory) while compiling the code.

Please help me with the following
1. How to install cURL library and command line tool.
2. Or else can we do it without using cURL. The requirement is to read the web content (e.g, articles as in wikipedia, news) from the provided URL and write it into a flat file.

Thanks in advance.
closed account (3qX21hU5)
Most likely you will be using a library for this instead of coding your own which will take more time. So the best route would be to learn how to properly install a library and link it.

error (cURL.h: no file or directory)

Leads me to think that you didn't include the folder cURL.h is in, in your IDE's include folders.

So first what IDE are you using? If it is one I know I can walk your through it step by step if not I can give you some general advice on how it can be done.

For example if you are using Code::Blocks you can follow these steps.

1.Open up the project you are working on.

2. Go up to settings then compiler.

3. Click on the search directories tab then click add... and browse to the folder that holder the file cURL.h and select that folder.

4. Click ok and you should be good to go unless the cURL library requires linking (Which I'm not sure of). If it does I can walk through the linking process also.
Last edited on
Thank you for the reply.

I am compiling this program in UNIX (using putty) and not using any IDE. I need to compile it in UNIX only.
closed account (3qX21hU5)
So you are just using notepad (Or the UNIX equivilient) and something like NMake or even just compiling from command line? If that is the case I can't help much with it since I am not all the familiar Unix commands. Though I am sure there is someone else on this forum that can help you.

One suggestion would be to move this post to the Unix forums and change the title to how to include/link a library.

Sorry I couldn't be any help.
Yes I am compiling it from command line using g++. Thanks for the advice though.

Also, any other way (code) of doing this task of writing web content in a flat file will also work. If you can help me with that.
Topic archived. No new replies allowed.