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.

Grap text and put in topic script help

Old posts that have not been replied to for several years.
Locked
t
trinitykln

Grap text and put in topic script help

Post by trinitykln »

Hi

I'm pretty new in script tcl/tcl for eggdrop and I'm trying to make an script which either graps the text written on this page:

http://www.cstv.dk/ccdrift/

Or the tcl script graps the text it self...

Url to grap from: http://www.cybercity.dk/privat/kundeservice/index.phtml

my php ereg code which proberly could be optimized and don't work with tcl ?

Code: Select all

ereg("<p><b>Sidste åbne fejl:</b><hr size=1 noshade color=\"#49735D\">(.*)<p>\n<hr size=1>\n<b>Sidste 5 lukkede fejl:</b><hr size=1>", $search, $report); 
Could i port this to:

Code: Select all

regexp {^.*("<p><b>Sidste åbne fejl:</b><hr size=1 noshade color=\"#49735D\">(.*)<p>\n<hr size=1>\n<b>Sidste 5 lukkede fejl:</b><hr size=1>} $search $report
I would like the script to set topic in an chan with the text graped and check it every 5 or 10 min if changed....


what useless(?) code I have:

Code: Select all

proc ccdrift {

putserv "TOPIC $chan :$report"
}

Please someboddy help me or give me some hints...... :-?
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Use the http package (tcl manuals at http://tcl.tk/man/ ) to grab the file, then supply your regexp with a rule that will match the content on the page. :P
Last edited by user on Mon May 26, 2003 7:42 am, edited 1 time in total.
t
trinitykln

Post by trinitykln »

the php file is only accessable via http... therefore i thought an pure tcl solution var easier ?
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Regexp in tcl doesn't stuff the match(es) into an array like php does. You have to supply a variable name for each part of the rule marked for reporting.

http://forum.egghelp.org/viewtopic.php?t=4319
http://www.tcl.tk/man/tcl8.3/TclCmd/regexp.htm
http://www.tcl.tk/man/tcl8.3/TclCmd/re_syntax.htm
Locked