开发者

How to make a C code to fetch some content from the internet?

Suppose I want my C code to fetch the headline 开发者_StackOverflowfrom a website, like www.example.com

How to do that?

Can I write a program in C to do this?


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.


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.


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..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜