Getting HTTP status of a site in C under Linux
I want to create an application to check if a site is active or inactive (homework for networking ). For that I need to connect to the ip at which the site resides and get the status. For that I create a socket with the IP and the port 80 and try to read an answer.
First of all I want to ask if this is the correct course of actions.
Second, I cannot connect with my socket to the designated IP and port 80 - it gives me: Connection refused. How can I connect to the server on which the site resides correctly.
What message I should send to the server to get as response the status of the site or better an error code (404, 500, 200) from which I can see the status of the site.
PS. I can use only the standard libraries on C under LINUX (it is a homework and I cannot use libraries made by someone else)
Thank you in advance. Any help will be much appreciated.