There have been some threads on a german mirc-scripting board, which I've made a sample code for (maybe a year ago...)
There isn't that much to explain, I used binary variables and file handling...

Code:
alias down {
  if ($sock(down)) { return }
  sockopen down $1 80
  sockmark down $2-
}
on *:sockopen:down: {
  if ($sockerr) { return }
  var %s = sockwrite -n $sockname, %f = $sock($sockname).mark
  sockmark $sockname
  .fopen -o down $qt($gettok(%f,-1,47))

  %s GET %f HTTP/1.1
  %s Host: $sock($sockname).addr
  %s User-Agent: mIRC $version
  %s Connection: close
  %s $crlf
}
on *:sockread:down: {
  if ($sockerr > 0) { return }
  if ($sock($sockname).mark == 1) { goto download }

  var %s
  sockread %s
  while ($sockbr > 0) {
    if (%s == $null) {
      sockmark $sockname 1
      return
    }
    sockread %s
  }
  return

  :download
  var &s
  sockread &s
  while ($sockbr > 0) {
    .fwrite -b down &s
    sockread &s
  }
}
on *:sockclose:down: {
  .fclose down
  echo -agt Download finished.
}


/down host.name.net /path/to/the/file.jpg

Example:
/down mirc.cachefly.net /images/indexlogo.gif
Will download http://mirc.cachefly.net/images/indexlogo.gif ...

Don't know if my method is clear, but I can't really think of something worth to explain...
So just ask if there's something strange.
(Why did I use goto? - Don't know... I think it suits fine in this case :P
Yes, there are also missing some checks like 'does the file exist?', but it's just an example...
Paths and so on should be easy to change.)

Edit:

Well.. first I was saving the download-path with sockmark.
At the sockopen, I save the $sockmark value to a local variable first, to use it in the header later.
I clear sockmark and open the file I'm trying to write right into.
Sending the header and waiting for reply...

The sockread event checks for errors first...
After that, it consists of 2 parts.
The first one is for the header...
After the header, there's always following an empty line.
When this line comes, $sockmark is being filled with "1" to tell the script, it should goto download...
It does, thats the 2nd part, which writes the data to the file.

Last edited by Pivo; 17/09/08 11:45 AM.