Thread: How to make URL connection and read from URL

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    2

    Smile How to make URL connection and read from URL

    Hello everyone,

    I've been looking for this for days, but I can't find anything. I want to make a URL connection and read from that URL. I will use that to parse XML. I don't think parsing the XML would be a problem because I've read about some libraries that can do this.

    The problem is making the URL connection and reading from it. Is there a library to do this? I've done it in PHP and Java, but I'm new to C and I can't find it.

    Thanks in advance,

    Antonio

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    I'm sure there are libraries that do this, but I've never used them. You'll want to look into sockets - as they're a very big part of doing networking in C. Create a socket to the desired address on port 80, send an HTTP request for the file you want, and then read from the socket.

    edit: Beej's Guide is a very good introduction to sockets: http://www.beej.us/guide/bgnet/

  3. #3

  4. #4
    Registered User
    Join Date
    Feb 2010
    Posts
    2
    @sean, Thanks a lot. I didn't know about sockets, I'll definitely check that out. Thanks so much for the link to the guide d—(^_^)—b

    @Memloop, thanks for your suggestion, I've used cURL for PHP and I was kind of looking for a similar thing.

    Thank you all!

    Antonio

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. multiple forks in one client connection (ftpclient)
    By Dynamo in forum Networking/Device Communication
    Replies: 5
    Last Post: 01-16-2011, 12:41 PM
  2. Function call from another .c module
    By Ali.B in forum C Programming
    Replies: 14
    Last Post: 08-03-2009, 11:45 AM
  3. how to read data from 15 pin connection?
    By Euphorica in forum Networking/Device Communication
    Replies: 0
    Last Post: 06-27-2008, 03:38 PM
  4. Headers that use each other
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 10-03-2003, 04:25 AM
  5. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM