Re: Finding and modifying links

>Hi all
>
>I am writing an application that fetches a HTML page from a web server. I
>want to check each link in that page and, in certain cases, change it to
>point somewhere else. Is there a libwww function to do this? I have looked
>at the showlinks.c example program, which finds the links nicely, but how
>can one convert them within the page?
>


what I did was to define a findLink callback for the HTML parser (I don't
have access to the sources right now, so I cannot tell you the right
function name).

In the callback, if I need to change a link, I will set value[attribute] to
my new value (without freeing the old one - I think it will crash if you do
that).

I also have callbacks set for tags and text, so that I dump the new page
content to an output file.

I still have the problem that I would like to assign the right extensions
to file names, but in the findLink callback of course I don'k know about
the mime type of the file
I will be downloading ): Any idea on how I could do this without recursively
start a new request every time I find a link ?

-- Raffaele

Received on Wednesday, 3 March 1999 13:45:24 UTC