mIRC Home    About    Download    Register    News    Help

Topic Options
#173083 - 20/03/07 03:02 PM socket experts needed!
pouncer Offline
Hoopy frood

Registered: 02/10/05
Posts: 827
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?


Edited by pouncer (20/03/07 03:03 PM)

Top
#173084 - 20/03/07 03:20 PM Re: socket experts needed! [Re: pouncer]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
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.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#173087 - 20/03/07 03:34 PM Re: socket experts needed! [Re: Riamus2]
pouncer Offline
Hoopy frood

Registered: 02/10/05
Posts: 827
hm i did a search and found this thread:

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

fibreoptics put a post with example code! but he used bread, should it not be sockread?

Top
#173088 - 20/03/07 03:53 PM Re: socket experts needed! [Re: pouncer]
pouncer Offline
Hoopy frood

Registered: 02/10/05
Posts: 827
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)


Edited by pouncer (20/03/07 03:53 PM)

Top
#173101 - 20/03/07 07:46 PM Re: socket experts needed! [Re: pouncer]
hixxy Offline
Hoopy frood

Registered: 06/09/05
Posts: 2876
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 }

Top
#173110 - 20/03/07 09:07 PM Re: socket experts needed! [Re: hixxy]
pouncer Offline
Hoopy frood

Registered: 02/10/05
Posts: 827
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

Top
#173169 - 21/03/07 07:54 PM Re: socket experts needed! [Re: pouncer]
hixxy Offline
Hoopy frood

Registered: 06/09/05
Posts: 2876
Code:
var %offset = 1
while ($bfind(&in,%offset,valign=up)) {
  echo -a $bvar(&in,$+($v1,-,$calc($v1 + 10))).text 
  %offset = $v1
}

Top