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 

Connect to website and retrieve a line of text

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
kerum
Voice


Joined: 11 Jan 2013
Posts: 8

PostPosted: Fri Jan 11, 2013 10:10 am    Post subject: Connect to website and retrieve a line of text Reply with quote

Hello everyone. I need a script for eggdrop that will let me make eggdrop go to a website and retrieve the text from it.

The website is a simple PHP script that echoes only one line of text. Now, I would like eggdrop to go there and write back that line of text in the IRC channel. It would look like this:

Quote:
<me> !webreq http://domain.com/script.php
<eggdrop> Your text is this and that.


Thank you.
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3584
Location: Mint Factory

PostPosted: Fri Jan 11, 2013 12:23 pm    Post subject: Reply with quote

Code:

bind pub - !webreq my:webreq

proc my:webreq {nick uhost hand chan text} {
   if {[scan $text {%s} url] != 1} {
      puthelp "NOTICE $nick :Error, correct syntax is: !webreq <url>"
      return
   }
   set token [::http::geturl $url]
   set content [::http::data $token]
   ::http::cleanup $content
   foreach line [split $content \n] {
      puthelp "PRIVMSG $chan :$line"
   }
}

Here's something simple that should do what you need.
_________________
I tawt I taw a puddy tat!
Back to top
View user's profile Send private message
kerum
Voice


Joined: 11 Jan 2013
Posts: 8

PostPosted: Fri Jan 11, 2013 12:31 pm    Post subject: Reply with quote

Thanks. I'll test it now.
I'm a newbie to all this... I put that code into web.tcl, right?

EDIT: Thank you!!! It works perfectly Smile Thanks again!
Back to top
View user's profile Send private message
Dominatez
Voice


Joined: 14 Jan 2019
Posts: 28
Location: United Kingdom

PostPosted: Fri Aug 16, 2019 6:05 pm    Post subject: Reply with quote

Is there any chance you could get this working again Caeser ?
Back to top
View user's profile Send private message
Dominatez
Voice


Joined: 14 Jan 2019
Posts: 28
Location: United Kingdom

PostPosted: Fri Aug 16, 2019 8:34 pm    Post subject: Reply with quote

Ok. Odd. When you pop in https://www.websitename.com

It start's spewing out the pages entire source code.
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 -> Script Requests 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