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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
TommyGun
Voice
Posts: 36 Joined: Fri May 26, 2006 6:11 pm
Location: The Netherlands
Contact:
Post
by TommyGun » Sat May 27, 2006 12:09 pm
Hello
I already searcht for parse website but didnt found usefull scripts.
So my question;
Is there a script to parse php files? So i typ !ud an then it parses:
http://udstats.ict-universe.com/hitpara.php
Or aint this possible?
Thanks!
Last edited by
TommyGun on Wed Jul 05, 2006 7:50 pm, edited 1 time in total.
krimson
Halfop
Posts: 86 Joined: Wed Apr 19, 2006 8:12 am
Post
by krimson » Sat May 27, 2006 12:41 pm
php code is parsed by the webserver's php interpretor and outputs html.
any html parser script would do.
TommyGun
Voice
Posts: 36 Joined: Fri May 26, 2006 6:11 pm
Location: The Netherlands
Contact:
Post
by TommyGun » Mon May 29, 2006 4:01 pm
Ah i saw that the stats from the link from the startpost are also avaible in XML.
Example;
http://tadah.mine.nu/xml/list.php?tabel ... 2006-05-29
I found a script;
Code: Select all
package require http
bind pub - !test foo
proc foo {n u h c t} {
set x [::http::geturl http://bar.com/moo.txt]
foreach e [split [::http::data $x] \n] {puthelp "privmsg $c :$e"}
::http::cleanup $x
}
But then i get this;
Code: Select all
-TommyBOT- <?xml version="1.0"?>
-TommyBOT- <list>
-TommyBOT- <listsize>30</listsize>
-TommyBOT- <offset>0</offset>
-TommyBOT- <flushlist>
-TommyBOT- <user>
-TommyBOT- <name>OldButNotSoWise</name>
-TommyBOT- <rank>1</rank>
-TommyBOT- <flush>1062</flush>
Etc etc. How can i fix that?
Thank you very much
TommyGun
Voice
Posts: 36 Joined: Fri May 26, 2006 6:11 pm
Location: The Netherlands
Contact:
Post
by TommyGun » Thu Jun 01, 2006 9:02 am
Bump
DragnLord
Owner
Posts: 711 Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA
Post
by DragnLord » Thu Jun 01, 2006 12:09 pm
the http package, by default, pulls the html (xml) code
trimming the code to gather the parts you want is usually done with regexp
another way is to regsub out the code by using
before output
the regsub way will not format, and may give errors on empty $e
TommyGun
Voice
Posts: 36 Joined: Fri May 26, 2006 6:11 pm
Location: The Netherlands
Contact:
Post
by TommyGun » Thu Jun 01, 2006 12:17 pm
How would the code looks like then?
Thanks
TommyGun
Voice
Posts: 36 Joined: Fri May 26, 2006 6:11 pm
Location: The Netherlands
Contact:
Post
by TommyGun » Sun Jun 04, 2006 6:29 pm
I tried to just place it somewhere in the code but that doesnt work
Maybe u can help?
DragnLord
Owner
Posts: 711 Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA
Post
by DragnLord » Sun Jun 04, 2006 6:46 pm
Code: Select all
foreach e [split [::http::data $x] \n] {
regsub -all {<([^<])*>} $e {} e
puthelp "privmsg $c :$e"
}
TommyGun
Voice
Posts: 36 Joined: Fri May 26, 2006 6:11 pm
Location: The Netherlands
Contact:
Post
by TommyGun » Sun Jun 04, 2006 9:16 pm
Thanks for your help.
Now i have
Code: Select all
package require http
bind pub - !test
proc foo {n u h c t} {
set x [::http::geturl http://tadah.mine.nu/xml/list.php?tabel=subteamoffset&prefix=rah&team=%5BDPC%5DDivision_Brabant]
foreach e [split [::http::data $x] \n] {puthelp "privmsg $c :$e"}
regsub -all {<([^<])*>} $e {} e
puthelp "privmsg $c :$e"
}
But i still get the same output. Am i doing someting wrong?
Sorry for my nooby
DragnLord
Owner
Posts: 711 Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA
Post
by DragnLord » Sun Jun 04, 2006 10:00 pm
you left the old
Code: Select all
foreach e [split [::http::data $x] \n] {puthelp "privmsg $c :$e"}
in there, you should have changed it with what I gave you
TommyGun
Voice
Posts: 36 Joined: Fri May 26, 2006 6:11 pm
Location: The Netherlands
Contact:
Post
by TommyGun » Mon Jun 05, 2006 9:44 am
I did forget to say that;
Code: Select all
package require http
bind pub - !test
proc foo {n u h c t} {
set x [::http::geturl http://tadah.mine.nu/xml/list.php?tabel=subteamoffset&prefix=rah&team=%5BDPC%5DDivision_Brabant]
foreach e [split [::http::data $x] \n] {
regsub -all {<([^<])*>} $e {} e
puthelp "privmsg $c :$e"
}
Doesnt work. It says;
Code: Select all
[15:44] Tcl error in file 'TommyBOT.conf':
[15:44] missing close-brace
while executing
"proc foo {n u h c t} {
set x [::http::geturl http://tadah.mine.nu/xml/list.php?tabel=subteamoffset&prefix=rah&team=%5BDPC%5DDivision_Brabant]
forea..."
(file "TommyBOT.conf" line 1354)
[15:44] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
[tommygun@server eggdrop]$
I don't see where it goes wrong. Thanks
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Mon Jun 05, 2006 10:52 am
The error tells you what the problem is, look at the braces.
Code: Select all
package require http
bind pub - !test
proc foo {n u h c t} {
set x [::http::geturl http://tadah.mine.nu/xml/list.php?tabel=subteamoffset&prefix=rah&team=%5BDPC%5DDivision_Brabant]
foreach e [split [::http::data $x] \n] {
regsub -all {<([^<])*>} $e {} e
puthelp "privmsg $c :$e"
}
}
TommyGun
Voice
Posts: 36 Joined: Fri May 26, 2006 6:11 pm
Location: The Netherlands
Contact:
Post
by TommyGun » Mon Jun 05, 2006 12:55 pm
No errors anymore, but no text neither
<TommyGun> !test
<TommyGun> !test
<TommyGun> !test
TommyGun
Voice
Posts: 36 Joined: Fri May 26, 2006 6:11 pm
Location: The Netherlands
Contact:
Post
by TommyGun » Mon Jun 12, 2006 12:04 pm
bump
deadite66
Halfop
Posts: 74 Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK
Post
by deadite66 » Tue Jun 13, 2006 2:55 am
add foo on the end of the bind
<- tcl newb