Here is my code:
on *:SOCKOPEN:site*: {
echo -s *** $sockname ( $+ $sock($sockname).ip $+ ) opened
sockwrite -n $sockname GET / HTTP/1.1
sockwrite -n $sockname Host: www.site.net
sockwrite -n $sockname Connection: keep-alive
sockwrite $sockname $crlf
}
on *:SOCKCLOSE:site*: echo -s *** $sockname ( $+ $sock($sockname).ip $+ ) closed.
on *:SOCKREAD:site*: {
sockread %socktemp
if (%socktemp) {
write file.txt $removehtml(%socktemp)
}
}
alias removehtml {
var %a
echo -s $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,,%a)
return %a
}
After running the code, I have the output (the text of the page, without any html tags) inside file.txt (including the HTTP GET headers).
Few problems I have here, next time I will run the code, it will write once again to the end of the file, while I need to write it
instead of the previous output. How do I do it?
Another problem I have is that while the running of the output into file.txt, I see numbers outputed and I don't really understand what are those numbers (though I assume it's the number of $regsub actions), anyway I'd like to gt rid of those numbers or at least to hide them, but I didn't manage to...
That's all for now, thanks in advance!