Code: Select all
package require http
package require tls
::http::register https 443 tls:socket
bind pub - .adzan pub:sholat
proc tls:socket args {
set opts [lrange $args 0 end-2]
set host [lindex $args end-1]
set port [lindex $args end]
::tls::socket -servername $host {*}$opts $host $port
}
proc pub:sholat {nick uhost hand chan text} {
global snamadaerah skodedaerah
set skodedaerah ""
set snamadaerah ""
if {$text == ""} {
puthelp "NOTICE $nick :Gunakan: !adzan kisaran"
return 0
}
set namanih [string tolower $text]
switch -- $namanih {
"ambarawa" { set skodedaerah "1"
set snamadaerah "Ambarawa" }
"ambon" { set skodedaerah "2"
set snamadaerah "Ambon" }
"amlapura" { set skodedaerah "3"
set snamadaerah "Amlapura" }
"amuntai" { set skodedaerah "4"
set snamadaerah "Amuntai" }
"argamakmur" { set skodedaerah "5"
set snamadaerah "Argamakmur" }
"atambua" { set skodedaerah "6"
set snamadaerah "Atambua" }
"babo" { set skodedaerah "7"
set snamadaerah "Babo" }
"bagan siapiapi" { set skodedaerah "8"
set snamadaerah "Bagan Siapiapi" }
"bajawa" { set skodedaerah "9"
set snamadaerah "Bajawa" }
"balige" { set skodedaerah "10"
set snamadaerah "Balige" }
default {
set skodedaerah "140"
set snamadaerah "Kisaran"
}
}
Pub:ShareAdzan $skodedaerah $snamadaerah $chan
}
proc Pub:ShareAdzan {skodedaerah snamadaerah chan} {
global sharesubuh sharedzuhur shareashar sharemaghrib shareisya
# set connect [::http::geturl http://jadwal-sholat.info/daily.php?id=$skodedaerah]
# set connect [::http::geturl http://jadwalsholatimsak.com/daily.php?id=$skodedaerah]
set connect [::http::geturl https://www.jadwalsholat.org/adzan/daily.php?id=$skodedaerah]
set files [::http::data $connect]
# set l [regexp -all -inline -- {.*?<tr class="table_light" align="center"><td><b>.*?</b></td><td>.*?</td><td>(.*?):(.*?)</td><td>(.*?):(.*?)</td><td>(.*?):(.*?)</td><td>(.*?):(.*?)</td><td>(.*?):(.*?)</td></tr>.*?<tr class="table_block_title"><td colspan="7">} $files]
set l [regexp -all -inline -- {.*?<tr class="table_light" align="center"><td><b>.*?</b></td><td>.*?</td><td>(.*?):(.*?)</td><td>.*?</td><td>.*?</td><td>(.*?):(.*?)</td><td>(.*?):(.*?)</td><td>(.*?):(.*?)</td><td>(.*?):(.*?)</td></tr>.*?<tr class="table_block_title"><td colspan="9">} $files]
if {[llength $l] != 0} {
foreach {black a b c d e f g h i j} $l {
set a [string trim $a " \n"]
set b [string trim $b " \n"]
set c [string trim $c " \n"]
set d [string trim $d " \n"]
set e [string trim $e " \n"]
set f [string trim $f " \n"]
set g [string trim $g " \n"]
set h [string trim $h " \n"]
set i [string trim $i " \n"]
set j [string trim $j " \n"]
regsub -all {<.+?>} $a {} a
regsub -all {<.+?>} $b {} b
regsub -all {<.+?>} $c {} c
regsub -all {<.+?>} $d {} d
regsub -all {<.+?>} $e {} e
regsub -all {<.+?>} $f {} f
regsub -all {<.+?>} $g {} g
regsub -all {<.+?>} $h {} h
regsub -all {<.+?>} $i {} i
regsub -all {<.+?>} $j {} j
putlog "Ambil Data Manual Dari http://jadwalsholatimsak.com/"
set sharesubuh "$a:$b:00"
set sharedzuhur "$c:$d:00"
set shareashar "$e:$f:00"
set sharemaghrib "$g:$h:00"
set shareisya "$i:$j:00"
puthelp "PRIVMSG $chan :\[Jadwal Sholat \00307$snamadaerah\003 Dan Sekitarnya\] Subuh: $sharesubuh - Dzuhur: $sharedzuhur - Ashar: $shareashar - Maghrib: $sharemaghrib - Isya: $shareisya"
set skodedaerah ""
set snamadaerah ""
}
}
}
Code: Select all
Tcl error [pub:sholat]: wrong # args: should be "tls::socket ?options? host port"
but not work in Ubuntu 14.04.5 LTS
can anybody help me?
thnks