MLIA

By AlexRapso on May 19, 2010

Tried learning sockets here is the end result. http://www.hawkee.com/phpBB2/viewtopic.php?t=10835 good thing to refer to even though i can't manage to log into places yet but thanks!

on *:TEXT:!mlia*:#: { 
  set %msgchan $chan
  set %mlianum $rand(1,10)
  set %mliamsg 1
  unset %stop
  /sockopen mlia mylifeisaverage.com 80 
}
on *:sockopen:mlia:{ 
  sockwrite -n $sockname GET / $+ $rand(1,500) HTTP/1.1 
  sockwrite -n $sockname Host: mylifeisaverage.com $+ $crlf $+ $crlf
}
on *:sockread:mlia:{
  if (%stop == on) { halt }
  if ($sockerr) {
    echo -a Error.
    halt
  }
  else {
    var %temptext
    sockread %temptext
    if (<div class="sc"> isin %temptext && %mlianum == %mliamsg) { set %on yes } 
    else if (<div class="sc"> isin %temptext && %mlianum != %mliamsg) { set %mliamsg $calc(%mliamsg + 1) }
    else if (%on == yes) {
      msg %msgchan %temptext
      unset %on
      unset %msgchan 
      unset %mlianum
      unset %mliamsg
      set %stop on
    }
  }
}

Comments

Sign in to comment.
SimplicityX   -  Sep 07, 2010

napa182 is a socket nerd! :p

 Respond  
napa182   -  May 19, 2010

you should look into using sockmark instead of vars

just a diff way of doing it

on $*:text:/@mlia$/iS:#: {
  if (!%f) {
    set -u5 %f 1
    if ($sock(mlia)) sockclose mlia
    sockopen mlia mylifeisaverage.com 80
    sockmark mlia $+(/,$r(1,3792)) msg #
  }
}
on *:sockopen:mlia: { 
  sockwrite -nt $sockname GET $gettok($sock(mlia).mark,1,32) HTTP/1.1 
  sockwrite -nt $sockname Host: $+($sock(mlia).addr,$str($crlf,2)) 
}
on *:sockread:mlia: {
  var %mlia | sockread %mlia
  if ($regex(%mlia,/(.+MLIA\56)/)) { $gettok($sock(mlia).mark,2-,32) $regml(1) | sockclose mlia }
}
 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.