This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

search a txt on the web

Old posts that have not been replied to for several years.
Locked
p
psykotrop

search a txt on the web

Post by psykotrop »

Hello is there anybody who can tell me how my bot can display on channel the text on this url : http://fulgore.goyman.com/~zone80/titre.php

this is the title of my radio at the moment. how can i make the bot disply it on channel ?

Txs for your help ! :D
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

Here is a proc to actually return the song:

Code: Select all

proc getsong_get {url} {
  if {[catch {set tok [::http::geturl $url]} error]} {
    putlog "An error occurred while connecting to $url."
    return
  }
  if {[::http::ncode $tok] != 200} {
    putlog "An error occurred while connecting to $url."
    ::http::cleanup $tok
    return
  }
  set data [::http::data $tok]
  ::http::cleanup $tok
  return $data
}
If you need help with another aspect of this, be more specific :)

Wcc
p
psykotrop

make your proc but no results..

Post by psykotrop »

bind pub o|o !test pub:titre

proc getsong_get {url} {
if {[catch {set tok [::http::geturl $url]} error]} {
putlog "An error occurred while connecting to $url."
return
}
if {[::http::ncode $tok] != 200} {
putlog "An error occurred while connecting to $url."
::http::cleanup $tok
return
}
set data [::http::data $tok]
::http::cleanup $tok
return $data
}

proc pub:titre { nick uhost handle channel data} {

getsong_get fulgore.goyman.com/~zone80/titre.php
puthelp "NOTICE $nick : $data"
}


Result :

[19:31] An error occurred while connecting to http://fulgore.goyman.com/~zone80/titre.php.
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

You need to get your admin to upgrade your Tcl. I tried to recode the script using egghttp, but for some reason this page causes eggdrop to kill the socket. I honestly don't have the time to code this using asynch sockets right now.

I did notice a few bugs, however:

Code: Select all

package require http
bind pub o|o !test pub:titre

proc getsong_get {url} {
  if {[catch {set tok [::http::geturl $url]} error]} {
    return "An error occurred while connecting to $url."
  }
  set data [::http::data $tok]
  ::http::cleanup $tok
  return $data
}

proc pub:titre {nick uhost hand chan text} {
  puthelp "NOTICE $nick :[getsong_get http://fulgore.goyman.com/~zone80/titre.php]"
}

p
psykotrop

All is right !

Post by psykotrop »

YEahh all is right i use http2.1.tcl mods with it and it works quite good :lol:
Really good and i want to tell you a big txs for your help !
@++
PsyKotrOp
Locked