Sephiroth
http://sephiroth.scifi-action.de/board/

$urltopic
http://sephiroth.scifi-action.de/board/viewtopic.php?f=4&t=108
Seite 1 von 1

Autor:  Sephiroth [ 23. November 2009 23:18 ]
Betreff des Beitrags:  $urltopic

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
}

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/