i wrote this little script that downloads the latest comic strip and saves it on C:\

the problem is it won't open.
when i use internet explorer to browse to the comic and open it in editor it looks exactly the same to me, except for a blank line my downloaded one has. if i remove the line it still won't open. and i have no idea how to have it not write the blank line. i tried if !$bvar(&r,1,99999) { do nothing } ..but it still writes it to the file. any help would be appreciated.


alias life {
var %d = $+(life.,$r(1,999999),$r(a,z))
sockopen %d www.reallifecomics.com 80
sockmark %d $1-
}
on *:sockopen:life.*:{
if !$sockerr {
var %s = sockwrite -n $sockname,%m = $sock($sockname).mark
%s GET $iif(%m,%m,/index.php) HTTP/1.0
%s Accept: */*
;%s Referer: http://www.reallifecomics.com/daily.php?strip_id=1203
%s Accept-Language: de-ch
%s User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
%s Host: www.reallifecomics.com
%s Pragma: no-cache
%s $crlf
}
}
on *:sockread:life.*:{
var %n = $sockname,%m = $sock(%n).mark,%r
if (*.png iswm %m) sockread &r
else sockread %r
if (*.png !iswm %m) {
tokenize 32 %r
if (Content-Type: image/* iswm $1-) {
var %f = $+($gettok($gettok(%m,3,61),1,38),.,$gettok($2,2,47))
sockmark %n %f
if ($isfile(C:\ $+ %f)) .remove C:\ $+ %f
}
if ($+(<img src='/index.php?do_command=show_strip&strip_id=,*,&,*'*) iswm $1-) {
life $gettok($1-,2,39)
sockclose $sockname
return
}
}
else {
while $sockbr {
bwrite C:\ $+ %m -1 -1 &r
sockread &r
}
}
}