socket variable data read - 26/03/06 08:22 AM
I am currently working on a script for Net Radio Broadcasting. I am looking for the bot to be able to display the current playing song on the server, so that it will display as <NowPlaying> Artist - Title I have a php script that simply displays Artist - Title but I'm running into the problem that the script displays all the extra information. Here is the script thus far:
alias wwwleech {
if (!$1-) { tokenize 32 http://darksideofthelake.com/bplaying.php 80 }
; /wwwleech <site and file> <port>
var %sn = $+(wwwleech.,$ticks)
sockopen %sn $gettok($1-,2,47) $iif(!$2,80,$2)
sockmark %sn $iif(!$2,$1-,$deltok($1-,-1,32))
}
on 1:sockopen:wwwleech.*:{
if ($sockerr) { echo -s error: $sock($sockname).wserr | return }
sockwrite -n $sockname GET $sock($sockname).mark HTTP/1.1
sockwrite -n $sockname ACCEPT: */*
sockwrite -n $sockname USER-AGENT: Mozilla
sockwrite -n $sockname CONNECTION: CLOSE
sockwrite -n $sockname HOST: $gettok($sockname,2,47)
sockwrite -n $sockname $crlf
}
on 1:sockread:wwwleech.*:{
if ($sockerr) { echo -s error: $sock($sockname).wserr | return }
:read
sockread %tmp
if ( * iswm %tmp) { if (%tmp != %lastplayed) { %lastplayed = %tmp | .signal -n newsong %tmp } }
if ($sockbr) { goto read }
}
on 1:sockclose:wwwleech.*:{ if ($sockerr) { echo -s socket error: $sock($sockname).wsmsg } }
on 1:signal:newsong:{
/msg #lobby %lastplayed
}
can anyone help me with this problem?
alias wwwleech {
if (!$1-) { tokenize 32 http://darksideofthelake.com/bplaying.php 80 }
; /wwwleech <site and file> <port>
var %sn = $+(wwwleech.,$ticks)
sockopen %sn $gettok($1-,2,47) $iif(!$2,80,$2)
sockmark %sn $iif(!$2,$1-,$deltok($1-,-1,32))
}
on 1:sockopen:wwwleech.*:{
if ($sockerr) { echo -s error: $sock($sockname).wserr | return }
sockwrite -n $sockname GET $sock($sockname).mark HTTP/1.1
sockwrite -n $sockname ACCEPT: */*
sockwrite -n $sockname USER-AGENT: Mozilla
sockwrite -n $sockname CONNECTION: CLOSE
sockwrite -n $sockname HOST: $gettok($sockname,2,47)
sockwrite -n $sockname $crlf
}
on 1:sockread:wwwleech.*:{
if ($sockerr) { echo -s error: $sock($sockname).wserr | return }
:read
sockread %tmp
if ( * iswm %tmp) { if (%tmp != %lastplayed) { %lastplayed = %tmp | .signal -n newsong %tmp } }
if ($sockbr) { goto read }
}
on 1:sockclose:wwwleech.*:{ if ($sockerr) { echo -s socket error: $sock($sockname).wsmsg } }
on 1:signal:newsong:{
/msg #lobby %lastplayed
}
can anyone help me with this problem?