Google Answers Logo
View Question
Q: Reading a web page programatically (the web page is the apache status page) ( Answered 5 out of 5 stars,   0 Comments )
Subject: Reading a web page programatically (the web page is the apache status page)
Category: Computers > Internet
Asked by: kentmm-ga
List Price: $15.00
Posted: 20 Apr 2006 21:17 PDT
Expires: 20 May 2006 21:17 PDT
Question ID: 721192
I need to read the contents of a web page from a C program.  The
program will be on the same system as the apache server.  The specific
page to be read is the apache status page displayed by  I don't want to bring up a
browser to get to this page to read it from a program.  Instead, is
there a way for a program to request an html page directly and then
read its contents?

The answer I am looking for are pointers to web sites that easily
explain how to do what I want to do.  Any verbage you add about the
general approach is appreciated also.

Though I prefer someone to answer this who knows apache, I suspect the
answer is general enough for a web knowledgable person to answer.
Subject: Re: Reading a web page programatically (the web page is the apache status page)
Answered By: efn-ga on 20 Apr 2006 22:10 PDT
Rated:5 out of 5 stars
Hi kentmm,

Your program can do this by opening a TCP/IP connection to the web
server on the same system and communicating with the web server using
HTTP (Hypertext Transfer Protocol), just the same as a browser would.

You should be able to identify the host with the standard loopback IP
address, for example, "".  The
host name "localhost" may also work.

You don't have to develop software to communicate in HTTP or deal with
TCP/IP or sockets.  You can get an HTTP client library that makes it
relatively easy.  Your program can give the library a URI and it will
give back a web page (or perhaps an error code).

libcurl is a well-known HTTP client library for C.  The web site
includes a tutorial and examples.

libcurl home page

libcurl tutorial

libcurl examples

The makers of libcurl maintain a page listing other HTTP and FTP
client libraries.  All are free, but not all are for C.  I looked at
some of these and they did not look as well-documented as libcurl.

libcurl works on many platforms, but other HTTP client libraries I
found were mostly platform-specific.  You didn't specify your
operating system, so I can't tell which of these you might be able to

Additional Links

Wikipedia on Loopback

I hope this is a satisfactory answer to your question.  If you need
any more information about this, please ask for a clarification and I
will do my best to help.

kentmm-ga rated this answer:5 out of 5 stars
Thank you.  The answer was very informative

There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy