Website API in C++

I am trying to make a program for the web game Nationstates.net using their api http://www.nationstates.net/pages/api.html and I want to know how do I call that in the program because I want to make a desktop version of the game with a new feature called NSwars to make have conflicts easier and Role play better
Seems to me that what you need is 1) generate the link (that should depend on what your program does) 2) get the web page and 3) parse the xml result. Fortunately for you, libcurl can get step 2, and libxml can solve your problem 3). On libcurl site there is an example to do both: http://curl.haxx.se/libcurl/c/htmltitle.html
I have another problem the libxml file xmlversion.h is giving me this error


c:\users\raven\documents\libxml2-2.9.1\include\libxml\parser.h(15): fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory

the only xmlversion.h is xmlversion.h.in there is no xmlversion.h in the include folder and I tried using the xmlwin32version.h instead, but no luck
You might need to add the include folder into the list of directories to check when #including files. What IDE are you using?
@Zhuge
I am using Visual Studio 2012 Express for desktop, plus I've added the include directories and lib directories to my project's properties which is how it's done in VS 2012 now it's a user defined thing.

what I have so far I am still working on it
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string>
#include <curl/curl.h>
#include <libxml/HTMLparser.h>
#include <iostream>
#include <Windows.h>
#include <WinUser.h>

using namespace std;

#define htmlDefaultSubelement;

int main()
{
	//Nationstaes API data below
	CURLcode curl_easy_perform(CURL * handle);
	CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info);
	
	curl_easy_setop(handle_t, CURLOPT_URL, "http://www.nationstates.net/cgi-bin/api.cgi?wa=1&q=resolution+dellog+votetrack");
  
Last edited on
Topic archived. No new replies allowed.