From: "Larsen, Jon" Date: 2005-09-28T23:42:00+09:00 Subject: Re: http.post question 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
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: > > cellpadding=4 cellspacing=0> value='/petcentral.phtml'>
bgcolor='#ffeeaa'>Username bgcolor='#ffffcc'> maxlength=20 onFocus='this.select()'>
colspan=2 bgcolor='#ffeecc'>
> > 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 ', 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 Simple, fast, news.