hi, i am trying to make a socket script to grab lyrics from a web page, and i am having a heck of a time doing it. the script below is what i have so far, but it keeps freezing mirc and i end up having to kill it with task manager.

Code:
 
;===================================================================================
;                      Socket Stuff for Lyrics Search
;===================================================================================

alias lyrics {
  echo -a Converting Data Into Query
  var %artist artist= $+ $$?="ARTIST NAME"
  var %title &title= $+ $$?="SONG TITLE"
  var %temp %artist $+ $chr(32) $+ %title
  var %query $replace(%temp,$chr(32),$chr(37) $+ 20)
  echo -a %query
  sockopen lyrics lyricsplugin.com 80
}

on *:sockread:lyrics:{
  if ($sockerr) {
    echo -a WARNING: An Error Occurred
    halt
  }
  else {
    sockread %'
    window @lyrics 
    while ( $sockbr != 0 ) { aline @lyrics %' }
    sockclose $sockname
    halt
  }
}

on *:sockopen:lyrics:{ 
  echo -a Getting info for: %query
  sockwrite -n $sockname GET /plugin/? $+ %query HTTP/1.1 
  sockwrite -n $sockname Host: www.lyricsplugin.com
  sockwrite -n $sockname Accept: */*
  sockwrite -n $sockname $crlf
}

alias nohtml {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
  return %x
}

 

All this does is write out something like: http: 200 ok or http: 300 found

is my script totally screwed up, or is it salvagable? confused


thanks


keek: Scots - intr.v. keeked, keekĀ·ing, keeks
To peek; peep.