PHP- Kodu:
; NBA Scoreboard
; orkz @ irc.lv
; pumpuri@gmail.com
alias nba {
.remove nbalive.txt
if ($sock(nbalive)) { sockclose nbalive }
sockopen nbalive www.nba.com 80
}
on *:sockopen:nbalive:{
sockwrite -n nbalive GET /scores/simpleScoreboard.jsp HTTP/1.1
sockwrite -n nbalive Host: www.nba.com
sockwrite -n nbalive Connection: close
sockwrite -n nbalive $crlf
}
on *:sockread:nbalive:{
sockread -fn &nbainfo
breplace &nbainfo 0 10
breplace &nbainfo 62 10
bwrite nbalive.txt -1 -1 &nbainfo
}
ON *:sockclose:nbalive: {
shownbalive
}
alias shownbalive {
var %lines $lines(nbalive.txt), %i 1, %nbagame 1
while (%i <= %lines) {
var %temp = $read(nbalive.txt,%i)
if (<game isin $read(nbalive.txt,%i)) {
if (: isin $gettok(%temp,8,34)) {
var %game_info = ( $+ Starts $gettok(%temp,8,34) $+ )
}
elseif (Start of isin $gettok(%temp,8,34)) {
var %game_info = ( $+ $gettok(%temp,8,34) $+ )
}
else {
if ($gettok(%temp,2,34) == $chr(32)) {
var %game_info = ( $+ $gettok(%temp,8,34) $+ )
}
else {
var %game_info = ( $+ $gettok(%temp,2,34) left in $gettok(%temp,8,34) $+ )
}
}
}
if (<htm isin $read(nbalive.txt,%i)) var %team_1 = $gettok($gettok(%temp,$numtok(%temp,34),34),4,124) $iif($gettok($gettok(%temp,10,34),9,124) >= 0,$+(04,$v1,))
if (<vtm isin $read(nbalive.txt,%i)) var %team_2 = $gettok($gettok(%temp,$numtok(%temp,34),34),4,124) $iif($gettok($gettok(%temp,10,34),9,124) >= 0,$+(04,$v1,))
if (%game_info) && (%team_1) && (%team_2) {
echo -a %nbagame $+ ) %team_2 $chr(124) %team_1 %game_info
inc %nbagame
unset %game_info %team_1 %team_2
}
inc %i
}
.remove nbalive.txt
}
/nba komutu ile çalışır. alttaki gibi sonuçları gösterir .
1) HOU 114 | TOR 100 (Final)
2) UTA 88 | PHI 89 (Final)
3) LAC 102 | CHA 93 (Final)
4) NOK 92 | NYK 90 (Final)
5) SAC 97 | MIA 103 (Final)
6) BOS 79 | DAL 85 (7:17 left in 4th Qtr)
7) DET 24 | PHX 26 (End of 1st Qtr)
8) POR | LAL (Starts 10:30 pm ET)
9) MIN | GSW (Starts 10:30 pm ET)