Exemple #1
0
int main(int argc, char **argv) {
    char *contentType = NULL;

    if (argv[1] != NULL) {
	if (argv[2] != NULL) 
	    xmlNanoHTTPFetch(argv[1], argv[2], &contentType);
        else
	    xmlNanoHTTPFetch(argv[1], "-", &contentType);
	if (contentType != NULL) xmlFree(contentType);
    } else {
        xmlGenericError(xmlGenericErrorContext,
		"%s: minimal HTTP GET implementation\n", argv[0]);
        xmlGenericError(xmlGenericErrorContext,
		"\tusage %s [ URL [ filename ] ]\n", argv[0]);
    }
    xmlNanoHTTPCleanup();
    xmlMemoryDump();
    return(0);
}
// not working in mingw. test.xml file is not saved properly as text file.
void FetchXMLFile() {
#if defined(LIBXML_HTTP_ENABLED)
    int ret_val;
    char *contentType; /* if available the Content-Type information will be returned at that location */

	xmlNanoHTTPInit();
	
	ret_val = xmlNanoHTTPFetch(XML_URL, "test.xml", &contentType);
	
	printf("ContentType: %s\n",contentType);
	printf("Retval %d\n", ret_val);
	
	xmlNanoHTTPCleanup();
#endif
}