[Prev][Next][Index][Thread]

libwww AND NT, getting a html-doc into memory-buffer



I've coded this small routine ;-), to load a document from the www in the memory-buffer (to parse it later...), but it does'nt work !

#include "WWWLib.h"
#include "WWWInit.h"
#include "WWWHTTP.h"

/*
**	...try to load a html-doc in the memory-buffer
*/
int main (int argc, char ** argv)
{
    HTRequest * request;
	HTChunk * chunk = NULL;
	HTEventInit();
    HTProfile_newPreemptiveClient("Test", "0.1");
    request = HTRequest_new();
	
    if (argc == 2) {
	char * url = argv[1];
	
	if (url && *url)
	    chunk = HTLoadToChunk(url, request);
        if (chunk) {    <- chunk is NULL !    
	    char * string = HTChunk_toCString(chunk);
	    printf("Content = %s\n", string);
	    HT_FREE(string);
	}
	else
	    printf("Falsche Parameter !\n");
    } 
    HTRequest_delete(request);			/* Löscht das request object */
    HTProfile_delete();
    return 0;
}

Please let me know if/when/how someone resolve a Problem like this.


Thanks

Martin


--------------------------------------------------------------------------------------------------------
Martin Ostrowski 

ioSYS GmbH                                              www.iosys.de
Im Bonsiepen 6                                           www.kolibri.de
45136 Essen