Solved

C++ URL connection example

Posted on 2013-01-04
4
597 Views
Last Modified: 2013-01-24
I need an example of a C++ class that will connect to a URL and read XML line by line.
Please advise.
0
Comment
Question by:dpalyca755
4 Comments
 
LVL 19

Expert Comment

by:drichards
ID: 38747055
Your question is underspecified.

For what platform and dev tools?
What protocol on the URL?
Does it need to be raw socket or can you use a client class from your dev environment?

XML line-by-line does not make sense as you will end up with a bunch of nonsense text that needs to be reassembled into usable XML which means also writing XML parsing code.  Why not use an XML parser?
0
 
LVL 22

Accepted Solution

by:
ambience earned 500 total points
ID: 38748218
I would recommend POCO toolkit and heres sample source from their unit tests that reads HTTP response line by line. I agree with drichards that reading XML line by line does not make much sense even for a parser that supports streaming.

https://github.com/pocoproject/poco/blob/develop/Net/testsuite/src/HTTPClientSessionTest.cpp

This is a Twitter client written with POCO (from samples), it does pretty much everything you might be interested in

https://github.com/pocoproject/poco/blob/develop/Net/samples/TwitterClient/src/Twitter.cpp
0
 
LVL 8

Expert Comment

by:Pramod Bugudai
ID: 38792457
I have simple exampl over here.

http://support.microsoft.com/kb/815659
0
 
LVL 11

Expert Comment

by:DeepuAbrahamK
ID: 38808728
Is this on windows/unix ?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question