I'd like to parse the result of a posted form .

For exemple, if I fill a form in a certain, way I may have after submitting the page something like :
        <p> Wrong id </p>

or I would have :

        <p> Good id</p>

So I'd like to parse this file and do one thing or another depending of the page .

I've seen that there are "AFTER filters" that may execute functions after the result page has been loaded in memory but don't know how to use those .

What can I do ?

Here's my C code :

#include <stdio.h>
#include "WWWLib.h"
#include "WWWInit.h"
#include "list.h"

PRIVATE HTChunk * result = NULL;

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)
  if (status == HT_LOADED && result && HTChunk_data(result)) {
    HTPrint("%s", HTChunk_data(result));   
  /* We are done with this request */
  /* Terminate libwww */

void    main()
    char *string;
    HTRequest * request = NULL;
    HTAnchor * anchor = NULL;
    HTAssocList * formfields = NULL;
    char * uri = NULL;
    string = "http://hal/cgi-bin/bluntman/log.cgi?lname=Duchemin&fname=Pascal"
    /* Create a new premptive client */
    HTProfile_newNoCacheClient("TestApp", "1.0");

    /* Need our own trace and print functions */

    /* Get trace messages */
#if 0

    /* Add our own filter to update the history list */
    HTNet_addAfter(terminate_handler, NULL, NULL, HT_ALL, HT_FILTER_LAST);

    /* Set the timeout for long we are going to wait for a response */

    /* Create a list to hold the form arguments */
    if (!formfields) formfields = HTAssocList_new();
    /* Parse the content and add it to the association list */
    HTParseFormInput(formfields, string);
    uri = string;
    if (uri && formfields) {
      /* Create a request */
      request = HTRequest_new();

        /* Set the default output to "asis" */
        HTRequest_setOutputFormat(request, WWW_SOURCE);

        /* Get an anchor object for the URI */
        anchor = HTAnchor_findAddress(uri);

        /* Post the data and get the result in a chunk */
        result = HTPostFormAnchorToChunk(formfields, anchor, request);

        /* Clean up the form fields */

        /* Go into the event loop... */
    } else {
      HTPrint("Type the URI to post to and the arguments for the POST operation. Encode spaces as '+'\n");
      HTPrint("\t%s <uri> 'a=1' 'b=+2+' 'c=3 ...'\n");


                        Pascal Duchemin
                Computer Science Student
                  Telecom section - EPITA
Email:          bluntman@inerd.fr - duchem_p@epita.fr
Homepage:               http://bluntman.inerd.fr
ICQ:                    #2955715