- From: Xiaobo Bian <bxb@sunjapan.co.jp>
- Date: Tue, 20 Aug 2002 12:06:37 +0900
- To: www-lib@w3.org
Hello, everyone: I am now using www-lib to post some form data to a cgi on the server side, then get the result from the cgi that returns xml content. I just want the xml source without parsing it. But always nothig is returned instead of the xml source. My program is as the following: /* start of main */ ...... HTChunk * result = NULL; HTRequest* request = NULL; HTAnchor* anchor = NULL; HTAssocList * list = ...; /* form data */ char* szURL; /* cgi url */ char* szResult; HTProfile_newNoCacheClient("Testing", "1.0"); HTPrint_setCallback(printer); HTTrace_setCallback(tracer); HTNet_addAfter(terminate_handler, NULL, NULL, HT_ALL, HT_FILTER_LAST); request = HTRequest_new(); HTRequest_setOutputFormat(request, WWW_SOURCE); anchor = HTAnchor_findAddress(szURL); result = HTPostFormAnchorToChunk(list, anchor, request); HTEventList_loop(request); szResult = HTChunk_data(result); printf("Result:\n%s\n", szResult); /* here, szResult always seems to be empty string */ ...... /* end of main */ PRIVATE int terminate_handler (HTRequest * request, HTResponse * response, void * param, int status) { HTEventList_stopLoop(); return 0; } In fact, the requested cgi is a simple program written in Perl. (Those dealing with parameters are omitted.) e.g. print "Content-type: text/xml\n\n"; print '<?xml version="1.0" encoding="iso-8859-1"?>'."\n"; print '<ROOT>'."\n"; print '<DATA>Hello World</DATA>'."\n"; print '</ROOT>'."\n"; How can I solve this problem? Any advice is appreciated. Thanks! -- Xiaobo Bian <bxb@sunjapan.co.jp>
Received on Monday, 19 August 2002 23:08:24 UTC