Jano Svitok
9/21/2007 3:14:00 PM
On 9/20/07, Chuck Dawit <chuckdawit@gmail.com> wrote:
> I want to run a check to see which pages have forms and which ones don't
> from a file with url's. I'm using the size of the form to make that
> determination. But after I get to the 13 url in the file I get an error
> and the script exists. Does anyone know why?
The error means mechanize could not read the webpage. Find out if it's
really the 13th url, no matter in what order they are, or whether is
it some particular url that makes problems.
(find the offending url and try that on its own).
If it's some particular url, try accessing the page from browser.
Otherwise, it might be a problem with mechanize and/or Net::Http or
anything that they use.
Finally few changes/enhancements, not related to your problem:
File.open("eliminate.txt") do |f|
noformfile = File.new("noform.txt", "w+")
formfile = File.new("form.txt" , "w+")
agent = WWW::Mechanize.new
f.each do |line|
page = agent.get(line)
forms = page.forms
if forms.size > 0 then
formfile.puts line
else
noformfile.puts line
end
end
end