From WikiChip
$urlget identifier - mIRC
< mirc‎ | identifiers

$urlget sends a HEAD/GET/POST/PUT/PATCH/DELETE to an http server. Returns an ID.




  • url - the url to access, must be prefixed with http:// or https:// (maximum url characters are 2000)
  • hgpuadfbrtic - switches to indicate how to proceed:
    • hgpuad - h for HEAD, g for GET, p for POST, u for PUT, a for PATCH, d for DELETE
    • fb - f to output the answer (without the responses headers) to a file, b to ouput to a binvar
    • r - resumes the processing
    • t - uses .part file if necessary
    • i - ignores SSL errors
    • c - cancel the processing
    • k - prevent redirection
  • target - the output: the filename if you used f, or a &binvar for b
  • alias - the name of the alias that is called at the end, this alias is called as a command with one parameter passed to it: the ID
  • headers - optional, a &binvar containing the headers to be sent, separated by $crlf
  • body - optional, a &binvar containing the data to be sent when you are POSTing
  • ID/N - the Nth urlget or the urlget referenced by the ID


  • .url - returns the url used
  • .redirect - returns the value of the location header if available
  • .method - returns the method used (GET/POST)
  • .type - returns the type of output, (binvar/file)
  • .target - returns the value of target (name of the binvar or filename)
  • .alias - returns the name of the alias used
  • .id - returns the ID.
  • .state - returns the state (ok, connect, download, fail)
  • .size - returns the value of the content-lenght header
  • .resume - returns 0 or 1 depending on if you are resumed/paused?
  • .rcvd - returns the number of bytes received after the header, could be different from .size after a failed download.
  • .time - returns the time taken to complete the processing, in millisecond
  • .reply - returns the response headers


Usage: /download

alias download {
  if (!$1) { return }
  if ($1 isnum) { 
    if ($urlget($1).state == fail) { echo 4 -at Error: Connection issues! | return }
    .run notepad.exe $qt($urlget($1).target)
  else {
    var %file = source.txt
    write -c $qt(%file)
    return $urlget($1,gfi,%file,download)

Type /urlget.test

; > POST / HTTP/1.1
; > Accept: */*
; > Test: Header
; > Accept-Encoding: gzip, deflate
; > User-Agent: mIRC
; > Host: localhost
; > Content-Length: 19
; > Connection: Keep-Alive
; > Cache-Control: no-cache
; > foo1=bar1&foo2=bar2
; < HTTP/1.1 200 OK
; < Connection: close
; < Content-Length: 5
; < hello
; url      http://localhost/
; redirect http://localhost/
; method   post
; type     binvar
; target   &target
; alias    urlget.callback
; id       1027
; state    ok
; size     5
; resume   0
; rcvd     5
; time     125
; reply    HTTP/1.1 200 OKConnection: closeContent-Length: 5
; response hello
alias urlget.test {
  var %url = $iif($1,$1,http://localhost/)
  bset -t &header 1 Test: Header
  bset -t &body 1 foo1=bar1&foo2=bar2
  var %id = $urlget(%url,pb,&target,urlget.callback,&header,&body)
alias urlget.callback {
  var %id = $1
  echo -agi9 url      $urlget(%id).url
  echo -agi9 redirect $urlget(%id).redirect
  echo -agi9 method   $urlget(%id).method
  echo -agi9 type     $urlget(%id).type
  echo -agi9 target   $urlget(%id).target
  echo -agi9 alias    $urlget(%id).alias
  echo -agi9 id       $urlget(%id).id
  echo -agi9 state    $urlget(%id).state
  echo -agi9 size     $urlget(%id).size
  echo -agi9 resume   $urlget(%id).resume
  echo -agi9 rcvd     $urlget(%id).rcvd
  echo -agi9 time     $urlget(%id).time
  echo -agi9 reply    $urlget(%id).reply
  if ($urlget(%id).type == binvar) {
    echo -agi9 response $bvar($urlget(%id).target,1-3000).text
alias urlget.listen {
  if (!$sock(urlget.listen)) socklisten -d urlget.listen 80
on *:socklisten:urlget.listen:{
  var %sockname = urlget.client. $+ $ticks
  if ($sock(%sockname)) return
  sockaccept %sockname
on *:sockread:urlget.client.*:{
  var %header
  if (!$sock($sockname).mark) {
    sockread %header
    while (%header != $null) {
      echo 3 -ag > %header
      if ($regex(%header,Content-Length: (\d+))) {
        hadd -m $sockname content-length $regml(1)
      sockread %header
    if ($sockbr) sockmark $sockname $true
  if ($sock($sockname).mark) && ($sock($sockname).rq) {
    sockread &read
    while ($sockbr) {
      hinc $sockname content-read $sockbr
      echo 6 -agi2 > $bvar(&read,1-3000).text
      sockread &read
  if ($hget($sockname,content-length) == 0) || ($v1 == $hget($sockname,content-read)) {
    socket.respond $sockname hello
    hfree -w $sockname
alias -l sockwrite {
  echo 12 -ag < $3-
  sockwrite $1-
alias -l socket.respond {
  var %sockname = $$1, %data = $2-
  sockwrite -n %sockname HTTP/1.1 200 OK
  sockwrite -n %sockname Connection: close
  sockwrite -n %sockname Content-Length: $len(%data)
  sockwrite -n %sockname $+($crlf,%data)


Added: mIRC v7.56
Added on: 06 Jul 2019
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.

See also[edit]

v · d · e mIRC identifier list

$ $$, $, $0, $1-, $!, $&, $*, $+, $++, $?

A $abook, $abs, $acos, $active, $activecid, $activewid, $adate, $address, $addtok, $addtokcs, $agent, $agentname, $agentstat, $agentver, $alias, $and, $anick, $ansi2mirc, $aop, $appactive, $appstate, $asc, $asctime, $asin, $atan, $atan2, $auto, $avoice, $away, $awaymsg, $awaytime

B $banlist, $banmask, $base, $beta, $bfind, $bindip, $bitoff, $biton, $bits, $bnick, $bvar, $bytes

C $calc, $caller, $cancel, $cb, $cd, $ceil, $chan, $chanmodes, $channel, $chantypes, $chat, $chr, $cid, $clevel, $click, $cmdbox, $cmdline, $cnick, $color, $colour, $com, $comcall, $comchan, $comchar, $comerr, $compact, $compress, $comval, $cos, $cosh, $count, $countcs, $cr, $crc, $creq, $crlf, $ctime, $ctimer, $ctrlenter

D $date, $day, $daylight, $dbuh, $dbuw, $dccignore, $dccport, $dde, $ddename, $debug, $decode, $decompress, $deltok, $devent, $dialog, $did, $didreg, $didtok, $didwm, $dir, $disk, $dlevel, $dll, $dllcall, $dname, $dns, $donotdisturb, $dqwindow, $duration

E $ebeeps, $editbox, $email, $emailaddr, $encode, $envvar, $error, $eval, $evalnext, $event, $eventid, $eventparms, $exists, $exiting

F $false, $feof, $ferr, $fgetc, $file, $filename, $filtered, $find, $finddir, $finddirn, $findfile, $findfilen, $findtok, $findtokcs, $fline, $flinen, $floor, $font, $fopen, $fread, $fromeditbox, $fserv, $fserve, $fulladdress, $fulldate, $fullname, $fullscreen

G $get, $getdir, $getdot, $gettok, $gmt, $group

H $halted, $hash, $height, $hfile, $hfind, $hget, $highlight, $hmac $hmatch, $hnick, $host, $hotline, $hotlinepos, $hotlink, $hotp, $hregex, $hypot

I $iaddress, $ial, $ialchan, $ibl, $idle, $iel, $ifmatch, $ifmatch2, $ignore, $iif, $iil, $inellipse, $ini, $initopic, $inmidi, $inmode, $inmp3, $inpaste, $inpoly, $input, $inrect, $inroundrect, $insong, $insongpause, $instok, $int, $intersect, $inwave, $inwho, $ip, $iptype, $iql, $isadmin, $isalias, $isbit, $isdde, $isdir, $isfile, $isid, $islower, $istok, $istokcs, $isupper, $isutf

K $keychar, $keyrpt, $keyval, $knick

L $lactive, $lactivecid, $lactivewid, $left, $leftwin, $leftwincid, $leftwinwid, $len, $level, $lf, $line, $lines, $link, $lock, $locked, $lof, $log, $log10, $logdir, $logstamp, $logstampfmt, $longfn, $longip, $lower, $ltimer

M $maddress, $mask, $matchkey, $matchtok, $matchtokcs, $maxlenl, $maxlenm, $maxlens, $md5, $me, $menu, $menubar, $menucontext, $menutype, $mid, $mididir, $mircdir, $mircexe, $mircini, $mkfn, $mklogfn, $mknickfn, $mnick, $mode, $modefirst, $modelast, $modespl, $mouse, $mousecx, $mousecy, $mousedx, $mousedy, $mousekey, $mouselb, $mousex, $mousey, $mousewin, $mp3, $mp3dir, $msfile, $msgstamp, $msgtags

N $N, $naddress, $network, $newnick, $nhnick, $nick, $nickmode, $no, $nofile, $nopath, $nopnick, $noqt, $not, $notags, $notify, $null, $numeric, $numtok, $nvnick

O $ok, $online, $onlineserver, $onlinetotal $onpoly, $opnick, $or, $ord, $os

P $parmN, $parms, $parseline, $parsetype, $parseutf, $passivedcc, $pi, $pic, $play, $pnick, $portable, $portfree, $pos, $poscs, $prefix, $prop, $protect, $puttok

Q $qt, $query

R $r, $raddress, $rand, $rands, $rawbytes, $rawmsg, $read, $readini, $readn, $regbr, $regerrstr, $regex, $regml, $regmlex, $regsub, $regsubex, $remote, $remove, $removecs, $remtok, $remtokcs, $replace, $replacecs, $replacex, $replacexcs, $reptok, $reptokcs, $result, $rgb, $right, $rnick, $round

S $samepath, $scid, $scon, $script, $scriptdir, $scriptline, $sdir, $send, $server, $serverip, $servertarget, $sfile, $sha1, $sha256, $sha384, $sha512, $shortfn, $show, $signal, $sin, $sinh, $site, $sline, $snick, $snicks, $snotify, $sock, $sockbr, $sockerr, $sockname, $sorttok, $sorttokcs, $sound, $speak, $sqrt, $sreq, $ssl, $sslcertsha1, $sslcertsha256, $sslcertvalid, $ssldll, $ssllibdll, $sslready, $sslversion, $starting, $status, $str, $strip, $stripped, $style, $submenu, $switchbar, $sysdir

T $tan, $tanh, $target, $tempfn, $ticks, $time, $timeout, $timer, $timestamp, $timestampfmt, $timezone, $tip, $tips, $titlebar, $token, $toolbar, $topic, $totp, $treebar, $true, $trust

U $ulevel, $ulist, $unsafe, $upper, $uptime, $url, $usermode, $utfdecode, $utfencode

V $v1, $v2, $var, $vc, $vcmd, $vcmdstat, $vcmdver, $version, $vnick, $vol

W $wavedir, $wid, $width, $wildsite, $wildtok, $wildtokcs, $window, $wrap

X $xor

Y $yes

Z $zip

= =$nick