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

Using HTTee stream.



Hi,
        I want to know how I can set up the right output stream for a
request, that just save and parse one URL.
        I want to use the HTTee stream to perform this tasks :
        - the first stream must save the hardcoded URL to a file
        - the second stream must parse (HTML) URL's content to perform other
tasks, using HText interface.

    stream                                  HTTee       stream 1
======>=========stream from network=====>=======*=========>========save locally
                                                |
                                                |       stream 2
                                                |=========>========HTML parsing

--------------------------------------------------------------------------------
For example : 
... declaration ( global, local, HText ecc.. ) .....
FILE * fp ;
HTRequest * request = NULL;
HTList * conv = NULL ;    
conv = HTList_new () ;
HTLibInit (....,.... );
HTProtocol_add ( ....... ) ;
.... other statements .....
fp = fopen ( "dummy","w"); /* no check for semplicity */
request = HTRequest_new () ;
HTRequest_setMethod ( request, METHOD_GET ) ;
/* !!!!!!!!!!!!!!!! */
HTRequest_setOutputStream ( request, 
                            HTTee ( HTFWriter_new ( request, fp, NO ) /* is
this right ?? */ ,
                                    /* ??????? and here ???? */ ,
                                    NULL 
                                  )
                          )
.... ecc..... 
HTLibTerminate () ;
-------------------------------------------------------------------------------

Can you help me ? 

Thanks.

PS:  I'm using the library version 4.0D.

          
---------------------------------------------------------
     Giacomo Fiorentini                               /\
     Pisa University                                 /00\
     fiorenti@cli.di.unipi.it                        \gf/
     +39 050-544560                                   \/
---------------------------------------------------------