$parse / $parseAsync

By Mpdreamz on Jan 14, 2008

This snippet allows you to get the content of small websites and return them back!

$parse(URL[,argument1,argument2,...])

URL is a string where you can place %s markers which will be filled with the arguments you specify.

As a bonus theres an asynchronous version too, while the page is downloading mIRC can go on, once its downloaded it will perform the command you specifed on the recieved data!

$parseAsync (callback,URL[,argument1,argument2,...])

examples:

//echo -a $parse(http://hiscore.runescape.com/index_lite.ws?player=%s,zezima)
//echo -a $parse(http://rs.facepwn.com/Parsers/imdb.php?movie=%s,Devils+Advocate)
//echo -a $parse(http://rs.facepwn.com/Parsers/stats.php?user=%s&c1=%s&c2=%s,zezima,3,7)
//noop $parseAsync(echo -a Recieved:,http://rs.facepwn.com/Parsers/stats.php?user=%s&c1=%s&c2=%s,zezima,4,7)
alias parse { 
  .comopen xml msxml2.xmlhttp
  var %x $com(xml,open,1,bstr,get,bstr,$+( [ $regsubex($1,/%s/g,$chr(44) $ $+ $calc(\n +1) $chr(44)) ] ),bool,-1) $& 
    $com(xml,send,1) $com(xml,responseText,2),%x $com(xml).result
  .comclose xml
  return %x
}
alias comid if ($+($1,$com(0))) return $v1
alias parseAsync {
  .comopen $comid(x) msxml2.xmlhttp
  noop $com($v1,open,1,bstr,get,bstr,$+( [ $regsubex($2,/%s/g,$chr(44) $ $+ $calc(\n +2) $chr(44)) ] ),bool,0)
  noop $comcall($v1,noop $!com($1,responseText,2) $(|,) $1 $!com($1).result $(|,) .comclose $!1,send,1)
}

Comments

Sign in to comment.
Korvin   -  Jan 20, 2008

Very nicely and thoroughly done, 8/10

 Respond  
Spartacus   -  Jan 19, 2008

Someone needs to fix this rating system .. it must be broken :D This code is quite spiffy and works like a charm :P

 Respond  
Mpdreamz   -  Jan 16, 2008

wonders who rated this a 1.0 but failed to let me know why :(

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.