Original Post
Recently I have been looking at the different ways to create a web service. I am not talking about a web page service, but a service that could be used by an application, like when you put a CD in your computer and it downloads the track names. I have looked at rcp, xml-rpc, SOAP, REST, JSON-RPC, and custom peer-to-peer. Of all these choices, the RESTful web-service is the most interesting. An example of getting some information from java looks like this... It is amazing that you can get information in this way without messing with connections, ports, sockets, threads, etc... Now I realize that getting the webpage is a neat trick, but if that URL returned some data in xml, you have a service. So my question is, does anyone out there know how do this in C++. I spent some time looking at libraries, but I could not find one that I liked. I am sure the right library is out there, I just don't know what it is. If you have ever done this in C++, please share it with us. Thanks
import java.io.BufferedInputStream;
import java.io.StringWriter;
import java.net.URL;
import java.net.URLConnection;
public class UrlTest {
public static void main( String[] args ) throws Exception {
URLConnection conn = new URL("http://www.gamedev.net").openConnection();
BufferedInputStream in = new BufferedInputStream(conn.getInputStream());
StringWriter out = new StringWriter();
int read;
while((read = in.read()) != -1) {
out.write(read);
}
System.out.println(out.toString());
}
}