Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

WWW::Mechanize cannot create new gmail account

by gontham (Initiate)
on Oct 06, 2008 at 23:26 UTC ( #715666=perlquestion: print w/ replies, xml ) Need Help??
gontham has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I am trying to create a new gmail account with WWW::Mechanize using the script below, but it is not working, and it keeps loading the sign up page eventhough all the fields are filled correctly. Any suggestion or help would be really appreciated.
#!/usr/bin/perl use strict; use warnings; use WWW::Mechanize; use HTTP::Cookies; use LWP::Simple qw(getstore); #use LWP::Debug qw(+ -conns); ###Field values my $fname = 'john'; my $lname = 'smith'; my $login = 'testc.c.c.testc'; my $password = 'testtestc'; my $question = 'What is your primary frequent flyer number'; my $answer = 'my answer is the best answer'; my $google_captcha = ''; ###Setup WWW::Mechanize my $google = WWW::Mechanize->new(); $google->add_header( 'Accept-Encoding' => 'text/html' ); ###Start print "Fetching captcha image...\n"; $google->get('http://mail.google.com/mail/signup'); my @forms = $google->form_number(0); getstore($google->value("newaccounturl"),'create_google_captcha.jpg'); print "image download (create_google_captcha.jpg)\n\nEnter captcha word: "; $google_captcha = <>; chomp($google_captcha); $google->field("FirstName", $fname); $google->field("LastName", $lname); $google->field("Email", $login); $google->field("Passwd", $password); $google->field("PasswdAgain", $password); $google->field("selection", $question); $google->field("IdentityAnswer", $answer); $google->field("newaccountcaptcha", $google_captcha); $google->untick('PersistentCookie', "yes"); $google->untick('smhck', 1); $google->click_button(name => "submitbutton"); ###Output result open (out,'>page.html'); print out $google->content(); close (out); exit;

Comment on WWW::Mechanize cannot create new gmail account
Re: WWW::Mechanize cannot create new gmail account
by Anonymous Monk on Oct 07, 2008 at 00:23 UTC
    A Poor Workman Blames His Tools
    And there is no legitimate reason for you to want to do this other than to circumvent captcha, create spam accounts ...
Re: WWW::Mechanize cannot create new gmail account
by plobsing (Friar) on Oct 07, 2008 at 00:28 UTC
    Do you honestly expect us to help you with a spambot (why else would you automate something that you could only legitimately do once, twice tops)?

    I can see some potential issues with this:
    • Most of us don't appreciate spam
    • Google's probably not cool with it either
Re: WWW::Mechanize cannot create new gmail account
by leocharre (Priest) on Oct 07, 2008 at 00:59 UTC

    Let's assume for a minute that there's no malicious intent.

    Maybe you like gmail, like me- I would like every one of our corporate clients and their employees to use gmail.
    It hurts my feelings when a small business with ten employees pays a few grand a year to use m$ junk... anyhow..

    So maybe like me you think if you just set them up- just like that- they'll actually use their gmail accounts.
    You got a list of ten or twenty people... And you want to streamline the deal.

    How should you do this?
    Don't do it.

    That's the answer.

    Instead, do this: contact google about setting up services for a group of people.

    No no.. I'm not convinced! You say. I almost have it! I'm almost able to complete a sign up with my hacks!

    You know what's going to happen to your collection of mechanize calls and swanky regexes once they're working great?
    Google's going to rename their css ids, or change their signup altogether- and your valuable time will go down in flames. You will be the only one who will know your suffering. It will be lonely and you will have nothing to show for it.

      ok, maybe it's because i did not explain the use of this script but i don't get the severity of the replies (and the -6 reputation i just got).

      I am trying to create an email manager inside my program, so i want an interface to the gmail sign up page.
      It's easier for the user to create an account and i want to perform other function after the user creates an account, like saving the information entered in the program's database and setting up POP3... also i am downloading the captcha and providing it to the user.

      I do not believe this is considered spamming or malicious. And there is no "blaming my tools" going on, i just want to know what's wrong with the script.
      I guess contacting google would be the right thing to do, thanks leocharre.

        Why are you providing an interface to an interface? Google provides an interface to getting a gmail account. Why are you trying to hide their front end? Are you posing to your customers as an email provider?

        Pop3??? You mean so the user can log into their gmail account and check their email in another server, not gmail?
        Right?

        You don't mean that you want them to use thunderbird, squirrelmail, outlook express, etc - to check gmail- right? Because you're gonna get surprises.

        At this point I'm wondering if you even use gmail yourself.

        You think you can provide an easier means to create a gmail account with your tools? Maybe you *should* contact google. I bet they pay well.

        If you have any sort of legitimate business and you want to circumvent their signup method- please read their policies and disclaimers- all the mumbo jumbo.

        If you had a Lamborghini Diablo, would you work on it with your great grandpappy's rusty ol tools?

        The reaction is because people thought it likely that you were a spammer, and nobody likes spammers.

        Even your more detailed response says that you're basically screen scraping to set up a man in the middle attack. Particularly with the DNS issues that are out there, Google has to be worried about blocking man in the middle attacks. So if you got your script working, it won't necessarily just be accidental changes that break your script.

        Which means that, indeed, contacting Google is the right thing to do.

        I do not believe this is considered spamming or malicious.
        You better believe it. Still not convinced, ask google how they feel about it.

        And there is no "blaming my tools" going on, i just want to know what's wrong with the script.
        The title says "WWW::Mechanize cannot create new gmail account", WWW::Mechanize is the tool you're blaming.

Re: WWW::Mechanize cannot create new gmail account
by bichonfrise74 (Vicar) on Oct 07, 2008 at 03:25 UTC
    I agree that your script sounds too suspicious to be used for good intent.

    - bichonfrise74
Re: WWW::Mechanize cannot create new gmail account
by Cody Pendant (Prior) on Oct 07, 2008 at 07:56 UTC
    Short answer as to why this is failing: because Google really don't want you to do this, because they're smart, and because you're not the first person to try.

    If you want just one hint on doing things with WWW::Mechanize that websites really don't want you to do? Start by changing the User-Agent string so they don't know you're using WWW::Mechanize.



    Nobody says perl looks like line-noise any more
    kids today don't know what line-noise IS ...
Re: WWW::Mechanize cannot create new gmail account
by marto (Chancellor) on Oct 07, 2008 at 08:26 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://715666]
Approved by Lawliet
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (14)
As of 2014-07-10 15:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (213 votes), past polls