Thanks for pointing that out! That is my problem. -----Original Message----- From: Lyndon Samson [mailto:lyndon.samson / gmail.com] Sent: Wednesday, September 28, 2005 2:00 AM To: ruby-talk ML Subject: Re: http.post question <form action='/hi.phtml'... you seem to call loginpage.phtml Maybe thats the problem? On 9/28/05, Jon Larsen <jlarsen / guidance.com> wrote: > > I'm trying to recover a neopet creation for my son and thought this might > be > an opportunity for me to expand my ruby knowledge. > > My daughter remembers that the name of the neopet is dannyphantomXXX where > XXX is 3 digits. She also remembers the animal type. So if I can parse > through this list from 1 to 999 and check the animal type I should be able > to find the neopet or at least narrow the field. Once we find the neopet, > we have the password to access it. > > I'm writing a program that will post the neopet name to the login page > (http://www.neopet.com/loginpage.phtml). If the neopet name is valid it > will show an active neopet name and ask for the password. The > login page has a form on it: > > <form action='/hi.phtml' method='post'><table align=center width=300 > cellpadding=4 cellspacing=0><input type='hidden' name='destination' > value='/petcentral.phtml'><tr><td > bgcolor='#ffeeaa'><b>Username</b></td><td > bgcolor='#ffffcc'><input type='text' name='username' value='' size=12 > maxlength=20 onFocus='this.select()'></td></tr><tr><td align=center > colspan=2 bgcolor='#ffeecc'><input type='submit' value='Log In to > Neopets!'></td></tr></table></form> > > If I can post the username (dannyphantom999) to the form and get the > results of the page I'll be able to find all the specific animals and > narrow > the search. > > Here's my code: > > #! /usr/local/bin/ruby -w > > require 'net/http' > > neopetpre = "dannyphantom" > > h = Net::HTTP.new('www.neopets.com <http://www.neopets.com>', 80) > > resp, data = h.get('/loginpage.phtml', nil ) > puts "Code = #{resp.code}" > puts "Message = #{resp.message}" > resp.each {|key, val| printf "%-14s = %-40.40s\n", key,val } > puts data > > params = "username=dannyphantom999" > resp, data = h.post2('/loginpage.phtml', params ) > puts "Code = #{resp.code}" > puts "Message = #{resp.message}" > resp.each {|key, val| printf "%-14s = %-40.40s\n", key,val } > puts data > > The post updates the username but it doesn't seem to execute the page. > It doesn't return the results I'm expecting based on manually entering the > name and clicking on Log In to Neopets! > > Is there some way to get the page to act like I've clicked on the button? > > I'm running Ruby 1.8.2 on Windows XP sp2. > > Thanks. > > > > -- Into RFID? www.rfidnewsupdate.com <http://www.rfidnewsupdate.com> Simple, fast, news.