Solved

C++ URL connection example

Posted on 2013-01-04
4
577 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now