Thread: Get website content - C Sockets - Linux

  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
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    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
    Chappell Hill, Texas
    Posts
    2,332
    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.)
    Mainframe assembler programmer by trade. C coder when I can.

  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, 02:35 AM
  2. Replies: 3
    Last Post: 10-29-2003, 09:39 AM
  3. Linux Website
    By sean in forum Linux Programming
    Replies: 4
    Last Post: 07-09-2002, 03:24 PM