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 127.0.0.1, for example, "http://127.0.0.1/server-status". 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
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
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.