mIRC Homepage
Posted By: pouncer socket experts needed! - 20/03/07 03:02 PM
basically im trying to read data from e.g:
http://www.buzzen.com/chat/friend.php?nick=dave

so i do: /findu dave
Code:
alias findu {
  if ($sock(findu)) sockclose findu
  sockopen findu www.buzzen.com 80
  sockmark findu $$1
}

on *:SOCKOPEN:findu: {
  var %nick = $sock($sockname).mark
  sockwrite -n $sockname GET /chat/friend.php?nick= $+ %nick HTTP/1.1 $+ $crlf $+ Host: www.buzzen.com $+ $crlf $+ Cookie: lang=EN $+ $str($crlf, 2) 
}

on *:SOCKREAD:findu: {
  var %read
  sockread %read
  if (*valign=up* iswm %read) echo -a %read
}


im trying to grab the table from the page to show all the users and their rooms. at the moment im checking if it finds *valign* but it just echos line to long.

can someone help me parse the socket data and echo the names/rooms?
Posted By: Riamus2 Re: socket experts needed! - 20/03/07 03:20 PM
If the html lines are too long, you'll need to use binary variables/commands for dealing with them. If you do a search for "sockopen bread" (no quotes), you can probably find examples of how to do it. I don't use binary for anything, so I can't really help.
Posted By: pouncer Re: socket experts needed! - 20/03/07 03:34 PM
hm i did a search and found this thread:

https://forums.mirc.com/ubbthreads.php?ub...true#Post162620

fibreoptics put a post with example code! but he used bread, should it not be sockread?
Posted By: pouncer Re: socket experts needed! - 20/03/07 03:53 PM
I tried

Code:
on *:SOCKREAD:findu: {
  sockread -fn &in
  if (*valign=up* iswm $bvar(&in, 1-).text) {
    echo -a $bfind(&in, 1, valign=up)
  }
}


It keeps giving me:
* Line too long: $bvar (line 17, script4)
Posted By: hixxy Re: socket experts needed! - 20/03/07 07:46 PM
You can't do it like that.

You have to do something like:

Code:
if ($bfind(&in,1,valign=up)) { echo -a $bvar(&in,$+($v1,-,$calc($v1 + 10))).text }
Posted By: pouncer Re: socket experts needed! - 20/03/07 09:07 PM
Thanks hixxy, it does echo something, but i'm a bit unsure. any idea how I could make it echo all the valign=up entries

because each nickname in the table has a new 'valign=up' so i thought maybe parsing a loop to search for all the valign=up's and echo the nicknames rooms but im a bit unsure
Posted By: hixxy Re: socket experts needed! - 21/03/07 07:54 PM
Code:
var %offset = 1
while ($bfind(&in,%offset,valign=up)) {
  echo -a $bvar(&in,$+($v1,-,$calc($v1 + 10))).text 
  %offset = $v1
}
© mIRC Discussion Forums