<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/16654" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2009-02-25T00:14:14-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/16654</id>

		<entry>
		<author><name><![CDATA[iamdeath]]></name></author>
		<updated>2009-02-25T00:14:14-04:00</updated>

		<published>2009-02-25T00:14:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87546#p87546</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87546#p87546"/>
		<title type="html"><![CDATA[fetching data from web.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87546#p87546"><![CDATA[
Hi I am trying to fetch data from the web and paste it on IRC using MSG or NOTICE method, but for some reasons its not working. <br><div class="codebox"><p>Code: </p><pre><code># 1 : notice $nick# 2 : privmsg $nick# 3 : privmsg $channelset cricketmethod 2### Eventsbind pub - "!rating" ratingpackage require httpproc rating {nick uhost handle channel text} {  switch -- [string tolower [lindex [split $text] 0]] {    odi {      rating:download $nick $channel odi    }    test {      rating:download $nick $channel test    }    default {      putquick "NOTICE $nick :Commands:"      putquick "NOTICE $nick :!rating ODI"      putquick "NOTICE $nick :!rating TEST"    }  }}proc rating:download {nick chan class} {  global data  switch -exact -- $::cricketmethod {    "1" {set method "notice" ; set who "$nick"}    "2" {set method "privmsg" ; set who "$nick"}    "3" {set method "privmsg" ; set who "$chan"}  }putlog "Reply 2."  set url "http://icc-cricket.yahoo.com/rankings/rankings.html"  set data [getwebdata $url]  if {$data==0} {    putserv "$method $who :There was an error fetching the data. Contact an admin to report this or try again later."    return  }putlog "Reply 3."  set foundstart 0putlog "Reply 4."  foreach line [split $data \r\n] {putlog "Reply 5."putlog [string match "&lt;div id=\"rankings-header\"&gt;&lt;a name=\"$class\"&gt;" $line]; putlog "line:$line";    if {[string match -nocase "&lt;div id=\"rankings-header\"&gt;&lt;a name=\"$class\"&gt;" $line]} {putlog "Reply 6."      set word "\037\002[string range $line [expr 40 + [string length $class] -3] [expr [string length $line]-11]]\002\037"      regsub -all {Reliance Mobile ODI Championship} $word "\00300,04ICC ONE-DAY Cricket Ratings.\003" word      regsub -all {Reliance Mobile Test Championship} $word "\00300,03ICC TEST Cricket Ratings.\003" word      putserv "$method $who :$word"putlog "Reply 1."      set foundstart 1      set output ""    } elseif {$foundstart &amp;&amp; [string match -nocase {&lt;div class="rankings_bottom"&gt;*&lt;/div&gt;*} $line]} {      # output the date      regsub -all "&lt;div style=\"float:left;padding-left:10px;\"&gt;" $info " " info      ## regsub -all -- {&lt;div .*?&gt;} $line "" line       ## regsub -all -- {&lt;/div&gt;} $line " " line      set word [string range $line 29 [expr [string length $line]-15]]      putserv "$method $who :$word"      return    } elseif {$foundstart} {      # firstcol - the ranking      if {[string match -nocase {&lt;div class="firstcol"&gt;*&lt;/div&gt;} $line]} {        set word [string range $line 25 [expr [string length $line]-11]]        append output "[format %-3s $word]"      # secondcol = info bold      } elseif {[string match -nocase {&lt;div class="secondcol"&gt;&lt;b&gt;*&lt;/b&gt;&lt;/div&gt;} $line]} {        set word [string range $line 26 [expr [string length $line]-11]]        append output "[format %-16s "\002$word\002"]"      # secondcol = info normal      } elseif {[string match -nocase {&lt;div class="secondcol"&gt;*&lt;/div&gt;} $line]} {        set word [string range $line 23 [expr [string length $line]-7]]        append output "[format %-15s $word]"      # output everything      } elseif {[string match -nocase {&lt;/div&gt;} $line]} {        putserv "$method $who :$output"        set output ""      }    }  }}</code></pre></div>The problem is here I think:<br><div class="codebox"><p>Code: </p><pre><code>putlog "Reply 5."putlog [string match "&lt;div id=\"rankings-header\"&gt;&lt;a name=\"$class\"&gt;" $line]; putlog "line:$line";    if {[string match -nocase "&lt;div id=\"rankings-header\"&gt;&lt;a name=\"$class\"&gt;" $line]} {</code></pre></div>P.S: It's not the complete script.<br><br>Can anyone tell me what could be the problem?<br><br>Thanks.<br>iamdeath<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5982">iamdeath</a> — Wed Feb 25, 2009 12:14 am</p><hr />
]]></content>
	</entry>
	</feed>
