mIRC Home    About    Download    Register    News    Help

Print Thread
socket experts needed! #173083 20/03/07 03:02 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
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?

Last edited by pouncer; 20/03/07 03:03 PM.
Re: socket experts needed! [Re: pouncer] #173084 20/03/07 03:20 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
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
Re: socket experts needed! [Re: Riamus2] #173087 20/03/07 03:34 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
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?

Re: socket experts needed! [Re: pouncer] #173088 20/03/07 03:53 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
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)

Last edited by pouncer; 20/03/07 03:53 PM.
Re: socket experts needed! [Re: pouncer] #173101 20/03/07 07:46 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
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 }

Re: socket experts needed! [Re: hixxy] #173110 20/03/07 09:07 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
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

Re: socket experts needed! [Re: pouncer] #173169 21/03/07 07:54 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
Code:
var %offset = 1
while ($bfind(&in,%offset,valign=up)) {
  echo -a $bvar(&in,$+($v1,-,$calc($v1 + 10))).text 
  %offset = $v1
}