Get website content - C Sockets - Linux

This is a discussion on Get website content - C Sockets - Linux within the C Programming forums, part of the General Programming Boards category; I started working with sockets recently, but I can't figure out how to get the socket, connect, etc to receive ...

  1. #1
    Registered User daveoffy's Avatar
    Join Date
    Feb 2010
    Location
    Michigan
    Posts
    4

    Get website content - C Sockets - Linux

    I started working with sockets recently, but I can't figure out how to get the socket, connect, etc to receive the content on a website. By content, I mostly want it to pull a html file from a website, and the html file just has text. I need that text in a char. Thanks in advance.

  2. #2
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,649
    Unless you have a compelling reason to do the sockets stuff yourself, just use libcurl. If you want to use sockets, then you need to study, understand, and implement the HTTP 1.1 RFC.

  3. #3
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    Yes, +1 on libcurl, and use the *easy* calls. I wrote craigslist scraper in a matter of a couple hours and had it working. Check your man pages for curl_easy_init. (and I still don't know much about sockets!! libcurl takes care of it all.)
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  4. #4
    Registered User daveoffy's Avatar
    Join Date
    Feb 2010
    Location
    Michigan
    Posts
    4
    thanks, it works great.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Port app from Windows to Linux
    By BobS0327 in forum Linux Programming
    Replies: 12
    Last Post: 02-12-2006, 01:35 AM
  2. Replies: 3
    Last Post: 10-29-2003, 08:39 AM
  3. Linux Website
    By sean in forum Linux Programming
    Replies: 4
    Last Post: 07-09-2002, 03:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21