egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help ::http::geturl

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Merky
Voice


Joined: 21 Jan 2007
Posts: 17

PostPosted: Tue Sep 11, 2018 1:59 pm    Post subject: Help ::http::geturl Reply with quote

Code:
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:
Tcl error [pub:sholat]: wrong # args: should be "tls::socket ?options? host port"


this tcl work in centos7
but not work in Ubuntu 14.04.5 LTS

can anybody help me?
thnks
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 572
Location: Tennessee, USA

PostPosted: Wed Sep 12, 2018 11:02 am    Post subject: Reply with quote

This is some info found on this page -> https://nikit.tcl-lang.org/page/tls
Quote:
Using TLS in 2016
•Starting with TLS 1.7 SSLv2 and SSLv3 are disabled by default
•TLSv1, TLSv1.1, and TLSv1.2 are enabled by default
•(tls 1.7.11) There is -autoservername true option which will perform the needed "-servername $host" work done in tls::socket, getting rid of the proc below, now you can do: http::register https 443 [list ::tls::socket -autoservername true]
•Building under Windows see BAWT Build Automation With Tcl / Batteries included [1]


Try replacing your ::http::register line with this ->
Code:
http::register https 443 [list ::tls::socket -autoservername true]

_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
Back to top
View user's profile Send private message Visit poster's website
Merky
Voice


Joined: 21 Jan 2007
Posts: 17

PostPosted: Thu Sep 13, 2018 2:27 pm    Post subject: Reply with quote

same problem too
Code:
[01:26:37] Tcl error [pub:sholat]: wrong # args: should be "tls::socket ?options? host port"
wrong # args: should be "tls::socket ?options? host port"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber