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.

Connect to website and retrieve a line of text

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
k
kerum
Voice
Posts: 8
Joined: Fri Jan 11, 2013 10:06 am

Connect to website and retrieve a line of text

Post by kerum »

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:
<me> !webreq http://domain.com/script.php
<eggdrop> Your text is this and that.
Thank you.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

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.
Once the game is over, the king and the pawn go back in the same box.
k
kerum
Voice
Posts: 8
Joined: Fri Jan 11, 2013 10:06 am

Post by kerum »

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 :) Thanks again!
User avatar
Dominatez
Halfop
Posts: 50
Joined: Mon Jan 14, 2019 5:08 pm
Location: United Kingdom

Post by Dominatez »

Is there any chance you could get this working again Caeser ?
User avatar
Dominatez
Halfop
Posts: 50
Joined: Mon Jan 14, 2019 5:08 pm
Location: United Kingdom

Post by Dominatez »

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

It start's spewing out the pages entire source code.
Post Reply