Peter Marsh wrote:
> I'm planning on writing a simple Wikipedia Bot, but I'm having a little
> difficulty. The bot needs to be able to log in to Wikipedia, but I'm not
> sure if this code is working. It returns the Main Page, which does
> happen after you log in, but I'm not entirely sure if this means if I've
> actually logged in or not. Here's what I've used (ripped from:
> http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html):
> 
> 
> require 'net/http'
> require 'uri'
> 
> res =
> Net::HTTP.post_form(URI.parse('http://en.wikipedia.org/w/index.php?title=Special:Userlogin&returnto=Main_Page'),{'wpName'=>'username_not_this_one',
> 'wpPassword'=>'password_not_this_one'})
>     puts res.body
> 
> My user & password were correct.
> 

On the main page, see the text where it says "Sign in / create account"? 
Search the body for that text. It won't say that if the login was 
successful.

Dan