Shows how to make GET or POST requests using an Ecore_Con_Url object, and make use of most of its API. See the complete example description at Ecore_Con_Url - customizing a request
#include <stdio.h>
#include <Ecore.h>
#include <Ecore_Con.h>
{
int i;
for (i = 0; i < url_data->
size; i++)
printf(
"%c", url_data->
data[i]);
}
{
char *str;
printf("\n");
printf(
"download completed with status code: %d\n", url_complete->
status);
printf("header: %s\n", str);
}
int
main(int argc, const char *argv[])
{
const char *type, *post_data = "";
if (argc < 3)
{
printf("need at least two parameters: < POST|GET > <url1> [post-data]\n");
return -1;
}
type = argv[1];
if (strcmp(type, "POST") && (strcmp(type, "GET")))
{
printf("only POST or GET are supported by this example.\n");
return -1;
}
if (argc > 3) post_data = argv[3];
if (!ec_url)
{
printf("error when creating ecore con url object.\n");
goto end;
}
if (!strcmp(type, "GET"))
else
if (!r)
{
printf("could not realize request.\n");
goto free_ec_url;
}
free_ec_url:
end:
return 0;
}