sockets - What's the easiest way to grab a web page in C? -


I'm working on an older Linux Linux version (QNX to be exact) and a way to catch a web page (

Did anyone get a snippet for this?

Note: I do not control it on the server and I already have work on the box besides what works There is a lot to do (adding to additional library is not really "easy" - huh I love it.)

I have some code, but it's also (open) SSL Therefore, there is a slight delay in posting here.

Abstract:

  • Split URLs (split urls scheme, host name, port number , Scheme specific part

  • Create a socket:

    s = socket (PF_INET, SOCK_STREAM, proto);

  • A sockaddr_in structure with remote IP and port

  • socket Away end micro connected to it:

    err = connect (s, Ander, size (addr)); Host:% s \ r \ n \ r \ n ", ...);

  • Send the request string:

    Write (S, Header, N); Read the data:

    while (n = reading (buffer, buffess) & gt; 0) ... }

  • Turn off the socket:

    shut down;

nb: The above pseudo code will collect both the response header and data between the two is the first blank line.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -