Hi,

I try to use libcurl in C++ with the DBpedia Spotlight
examples<https://github.com/dbpedia-spotlight/dbpedia-spotlight/wiki/Web-service>.
this is the code following this
example<http://ubuntuforums.org/archive/index.php/t-1435926.html>.
But there is no result. I don't have an annotation.

#include <curl/curl.h>

#include <cstdio>

#include <string>

#include<iostream>

using namespace std;


std::string buffer;


size_t curl_write( void *ptr, size_t size, size_t nmemb, void *stream)

{

buffer.append((char*)ptr, size*nmemb);

return size*nmemb;

}


int main(int argc, char **argv)

{

CURL *curl = curl_easy_init();

char *txt="http://spotlight.dbpedia.org/rest/spot/?text=President
Obama called Wednesday on Congress to extend a tax
break&spotter=LingPipeSpotter";

char* data=curl_easy_escape(curl, txt,0);

curl_easy_setopt(curl, CURLOPT_URL, data);

curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_write);

curl_easy_perform(curl);

curl_easy_cleanup(curl);

fwrite( buffer.c_str(), buffer.length(), sizeof(char), stdout);

return 0;

}

Any suggestion is welcome to get the annotation. Thank you.



Regards
Olivier
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Dbpedia-discussion mailing list
Dbpedia-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion

Reply via email to