views:

121

answers:

3

Suppose I want my C code to fetch the headline from a website, like www.example.com

How to do that?

Can I write a program in C to do this?

give me a start...

+5  A: 

Read the Beej's Guide to Network Programming.

This is a beginner's guide to socket programming with Internet sockets. It is meant to be a springboard that will launch you into the exciting world of TCP/IP programming.

pmg
Thats what i call a start.
Tom
+8  A: 

The easiest way is to use an existing HTTP library, for example libcurl or neon. If you are using some framework, maybe it already has a HTTP client.

Lukáš Lalinský
+1  A: 

There are many way to get your result, but the simple way would be to use a library since parsing html is often complicated.

You could try to use libxml

There is also libcurl which allows you to simulate a browser.

But trying to parse html yourself will be.... painful..

Boris Guéry