Returns the topic from an URL (doesn't convert special chars like ä or ß etc.)
Requires the $download() Snippet
alias urltopic {
!var %r
if ($download(tmpfile,HEAD,$replace($1-,$chr(32),$chr(44)),1)) && ($read(tmpfile,nw,Content-Type: *html*)) && ($download(tmpfile,GET,$replace($1-,$chr(32),$chr(44)),2)) {
if ($read(tmpfile,nw,*<title>*</title>*)) {
!var %I = $ifmatch
if ($regex(%I,<title>(.*)</title>)) {
%r = $regml(1)
}
}
elseif ($read(tmpfile,nw,*<title>*)) {
!var %I = $ifmatch
!var %- = $regex(%I,<title>(.*))
%r = $regml(1)
%I = 100
while (*</title>* !iswm $read(tmpfile,n,$calc($readn +1)) && %I) {
%r = %r $v2
!dec %I
}
%- = $regex($read(tmpfile,n,$readn),(.*)</title>)
%r = %r $regml(1)
}
}
if ($isfile(tmpfile)) { !.remove tmpfile }
%r = $remove(%r,$chr(9))
if ($len(%r)) { !return %r }
:error
!reseterror
!return $false
}