<?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/13976" />

	<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>2007-09-08T13:59:13-04:00</updated>

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

		<entry>
		<author><name><![CDATA[arcanedreams]]></name></author>
		<updated>2007-09-08T13:59:13-04:00</updated>

		<published>2007-09-08T13:59:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75792#p75792</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75792#p75792"/>
		<title type="html"><![CDATA[sooo close. Need help with geturl and data functions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75792#p75792"><![CDATA[
well I got it to work. As I suspected, when you log in, it redirects you. So I had to grab the meta data for the url to the re-direction.<br><br><br>Full working code:<br><div class="codebox"><p>Code: </p><pre><code>package require http####################################Profile Grabber####################################bind pub - !profile profileproc profile {nick host handle chan user} {    set url "http://forums.shooshtime.com/login.php?vb_login_username=zooshbot&amp;vb_login_password=zoosh&amp;s=&amp;do=login&amp;url=/member.php?username=$user"#putserv "PRIVMSG $chan :$url"set http [::http::geturl $url]#putserv "PRIVMSG $chan :$http"###################get meta info###################upvar #0 $http state        array set meta [set ${http}(meta)]        if {![info exist meta(Location)]} {           return $http        }        set redirect $meta(Location)        unset meta#putserv "PRIVMSG $chan :Redirecting to $redirect"#####################Set and cleanup#####################set newhttp [::http::geturl $redirect]set size [::http::size $newhttp]set code [::http::code $newhttp]set data [::http::data $newhttp]::http::cleanup $newhttp################Debug info#################putserv "PRIVMSG $chan :Size of html returned, $size"#putserv "PRIVMSG $chan :Html code returned, $code"#putserv "PRIVMSG $chan :Html data, $data"#regexp {To remove (.*?)you must} $data - notloggedin#regexp {has not registered and therefore (.*?) to view} $data - noprofile#putserv "PRIVMSG $chan :$notloggedin"#putserv "PRIVMSG $chan :$noprofile"#################Search Data#################regexp {Total Posts: &lt;strong&gt;(.*?)&lt;/strong&gt;} $data - tpostsregexp {Join Date: &lt;strong&gt;(.*?)&lt;/strong&gt;} $data - joinedregexp {Referrals: &lt;strong&gt;(.*?)&lt;/strong&gt;} $data - referralsregexp {&lt;td&gt;&lt;strong&gt;Birthday&lt;/strong&gt;:&lt;br /&gt;(.*?)&lt;/td&gt;} $data - bdayregexp {User Notes: &lt;strong&gt;(.*?)&lt;/strong&gt;} $data - unotes############Output############putserv "PRIVMSG $chan :User Status for $user"putserv "PRIVMSG $chan :Joined on $joined"putserv "PRIVMSG $chan :$tposts Total Posts"putserv "PRIVMSG $chan :$referrals Total Referrals"putserv "PRIVMSG $chan :$unotes Total User Notes"putserv "PRIVMSG $chan :Was Born On $bday"}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9286">arcanedreams</a> — Sat Sep 08, 2007 1:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-09-08T12:58:49-04:00</updated>

		<published>2007-09-08T12:58:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75790#p75790</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75790#p75790"/>
		<title type="html"><![CDATA[sooo close. Need help with geturl and data functions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75790#p75790"><![CDATA[
There are newlines in the output, so you won't see them, which is why I suggested using foreach [split $html \n]  to output each line.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sat Sep 08, 2007 12:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arcanedreams]]></name></author>
		<updated>2007-09-07T02:15:49-04:00</updated>

		<published>2007-09-07T02:15:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75770#p75770</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75770#p75770"/>
		<title type="html"><![CDATA[sooo close. Need help with geturl and data functions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75770#p75770"><![CDATA[
Not sure how to view the putcmdlog, so I just used putlog instead.<br><br>only error that showed up was expected. It was an error stating that the $uname variable couldn't be found.<br><br>I had it set to spam the channel with all the variables in the entire script.<br><br>It will go something like this:<br><br><br>$query: <a href="http://forums.shooshtime.com/login.php?vb_login_username=zooshbot&amp;vb_login_password=zoosh&amp;s=&amp;do=login" class="postlink">http://forums.shooshtime.com/login.php? ... =&amp;do=login</a><br><br>$http:  ::http::5<br><br>Then it will stop there and never output the $html variable.<br><br><br><br>I have tried simply changing the url to just the standard <a href="http://forums.shooshitme" class="postlink">http://forums.shooshitme</a>, and the $html variable will show up like this:<br><br>$html: &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" class="postlink">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>"&gt;<br><br><br><br>So it looks to me like when I use the url that I need to have the bot login to the site, it has trouble at the ::http::data part<br><br>If I had to guess I would say the http::data part isn't returning because after logging in, you are redirected to index.php, where the call in the url was to login.php<br><br>I also returned the value for ::http::size, and it comes back as 0<br>For the ::http::code it returns :HTTP/1.1 302 Found<br><br>Any idea why, or how to fix it?<br><br>Or perhaps an alternative way to get the bot to login to the site and grab info while its logged in?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9286">arcanedreams</a> — Fri Sep 07, 2007 2:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-09-07T00:18:19-04:00</updated>

		<published>2007-09-07T00:18:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75767#p75767</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75767#p75767"/>
		<title type="html"><![CDATA[sooo close. Need help with geturl and data functions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75767#p75767"><![CDATA[
Best bet is to debug what you are getting in your data var, by looking at it with putcmdlog lines after getting the webpage, like:<br><div class="codebox"><p>Code: </p><pre><code>set query "http://somewhere.com/$varwhatever"set page [::http::geturl $query]set html [::http::data $page] set count 0foreach line [split $html \n] {       incr count       putcmdlog "line$count '$line'"}</code></pre></div>It's also helpful to [catch] the geturl errors so you can see them, for example (from one of the movie grabber scripts I did):<div class="codebox"><p>Code: </p><pre><code>set movieurl "http://www.filmspot.com"catch {set page [::http::geturl $movieurl -timeout $::movietimeout]} errorif {[string match -nocase "*couldn't open socket*" $error]} {puthelp "PRIVMSG $chan :Error: couldn't connect to filmspot.com..Try again later."return}if { [::http::status $page] == "timeout" } {puthelp "PRIVMSG $chan :Error: Connection to filmspot.com timed out..Try again later."return}set html [::http::data $page]::http::cleanup $page        # Now we have data to work with and test the contents, etc..if {[regexp $regexm $html match moviedata]} {             # the $regexm var is set earlier in the script depending on              # which commandline was given to the script</code></pre></div>Thats a pretty standard template for any url-grabber script.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Fri Sep 07, 2007 12:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arcanedreams]]></name></author>
		<updated>2007-09-06T21:40:16-04:00</updated>

		<published>2007-09-06T21:40:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75764#p75764</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75764#p75764"/>
		<title type="html"><![CDATA[sooo close. Need help with geturl and data functions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75764#p75764"><![CDATA[
Here is what I have so far. Dont worry about the username and password..I just made those up for testing purposes.<br><br><div class="codebox"><p>Code: </p><pre><code>bbind pub - !joined joinedproc joined {nick host handle chan text} {    set query "http://forums.shooshtime.com/login.php?vb_login_username=zooshbot&amp;vb_login_password=zoosh&amp;s=&amp;do=login"set http [::http::geturl $query]set html [::http::data $http] regexp {&lt;strong&gt;Welcome, (.*?) &lt;/strong&gt;&lt;br /&gt;} $html - unameputserv "PRIVMSG $chan :$uname"</code></pre></div><br>That link will log you into the site.<br><br>From there, I can't get it to find any info on the page. I'm guessing it has something to do with the way it handles the link...perhaps it is taking the info from the actual login.php page<br><br>How do I get around this?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9286">arcanedreams</a> — Thu Sep 06, 2007 9:40 pm</p><hr />
]]></content>
	</entry>
	</feed>
