Regarding to TheMovieDB.org, I finished the parsing of 1 result (ignoring data if...
[maevies] / examples / gtranslate.c
1 #include <stdio.h>
2 #include <rest/rest-proxy.h>
3 #include <glib.h>
4 #include <unistd.h>
5
6 int main(int argc, char **argv) {
7
8         RestProxy *proxy;
9         RestProxyCall *call;
10         const gchar *payload;
11         const char *text;
12         gssize len;
13
14         g_thread_init(NULL);
15         g_type_init();
16
17         if (argc > 1) {
18                 text = argv[1];
19         } else {
20                 text = "Hola Mundo";
21         }
22
23         proxy = rest_proxy_new(
24                         "http://ajax.googleapis.com/ajax/services/language/translate",
25                         FALSE);
26         call = rest_proxy_new_call(proxy);
27 perror("");
28         rest_proxy_call_add_params(call,
29                         "v", "1.0",
30                         "q", text,
31                         "langpair","es|en",
32                         NULL);
33         rest_proxy_call_run(call, NULL, NULL);
34
35         payload = rest_proxy_call_get_payload(call);
36         len = rest_proxy_call_get_payload_length(call);
37         write(1, payload, len);
38         printf("\n");
39         g_object_unref(call);
40         g_object_unref(proxy);
41 }