- From: <neelu_dhiman@persistent.co.in>
- Date: Tue, 9 May 2006 14:04:43 +0530 (IST)
- To: www-lib@w3.org
Hi friends, I am passing an http GET request using libwww. The output of the request is an XML file that I want to dump to some text file. Here is the code: //Store Groups in a Text file // #include <w3c-libwww/WWWLib.h> #include <w3c-libwww/WWWHTTP.h> #include <w3c-libwww/WWWInit.h> PRIVATE int printer (const char * fmt, va_list pArgs) { return (vfprintf(stdout, fmt, pArgs)); } PRIVATE int tracer (const char * fmt, va_list pArgs) { return (vfprintf(stderr, fmt, pArgs)); } PRIVATE int terminate_handler (HTRequest * request, HTResponse * response, void * param, int status) { /* Check for status */ HTPrint("Load resulted in status %d\n", status); /* we're not handling other requests */ HTEventList_stopLoop (); /* stop here */ return HT_ERROR; } int main (int argc, char ** argv) { HTRequest * request = HTRequest_new(); char * url = "http://mail.persistent.co.in/cgi-bin/addrbook.cgi/xab/v1/get_groups.xml?sessionid=1c2200f500f5e60bf2d9f77b0f8c684e4&group=*"; char *filename="Groups"; HTProfile_newPreemptiveClient("TestApp", "1.1"); HTPrint_setCallback(printer); HTTrace_setCallback(tracer); #if 0 HTSetTraceMessageMask("sop"); #endif HTRequest_setOutputFormat(request, WWW_RAW); HTRequest_addConnection(request, "close", ""); HTNet_addAfter(terminate_handler, NULL, NULL, HT_ALL, HT_FILTER_LAST); if ( HTLoadToFile (url, request,filename)==YES) printf("Loaded in file"); else printf("Could not load"); HT_FREE(cwd); HTRequest_delete(request); HTProfile_delete(); return 0; } I am getting a zero length file. Please guide.
Received on Tuesday, 9 May 2006 08:38:40 UTC