Entering HTTPS web page

Discussion in 'Perl Misc' started by Mahaan, Sep 20, 2004.

  1. Mahaan

    Mahaan Guest

    Hello,

    I am trying to enter a HTTPS site -- Google Answers, for example. I
    found this simple Google Answers client at Google Answers
    (http://answers.google.com/answers/threadview?id=28442).

    Here's the code:

    ++++++++++++ Begin Code ++++++++++++

    use LWP;
    use HTTP::Request::Common;
    use HTTP::Cookies;

    $email='';
    $pass='ottffss';

    $ua = LWP::UserAgent->new;
    $ua->cookie_jar(HTTP::Cookies->new);

    $req=$ua->request(POST
    'https://answers.google.com/answers/main?cmd=login', ['email'=>$email,
    password=>$pass, 'submit'=>'Login']);
    if ($req->content=~ /Invalid login/){
    print "invalid login!\n";
    }else{
    print "welcome to google answers :)\n";
    $req=$ua->request(GET
    'https://answers.google.com/answers/main?cmd=myinvoices');
    print $req->content;
    $req->content=~/<td> Current Earnings \(what you will be paid\)
    for Answering Questions: <\/td> <td width="1%">
    \$([0-9]+(?:.[0-9]+)?)/;
    $ear=$1;
    $req->content=~/<td> Current Balance \(what you will be charged\)
    for Asked Questions: <\/td> <td width="1%"> \$([0-9]+(?:.[0-9]+)?)/;
    $char=$1;
    print "Will be paid: $ear \nWill be charged: $char\n";
    }

    ++++++++++++ End Code ++++++++++++

    Every time I run the code, I get a "400 URL missing" error.

    Any help would be appreciated.

    Thanks.
     
    Mahaan, Sep 20, 2004
    #1
    1. Advertising

  2. Mahaan

    Dan Wilga Guest

    In article <>,
    (Mahaan) wrote:

    > $req=$ua->request(POST
    > 'https://answers.google.com/answers/main?cmd=login', ['email'=>$email,
    > password=>$pass, 'submit'=>'Login']);


    Try using 'POST' instead of POST, and follow it with a comma.

    --
    Dan Wilga
    ** Remove the -MUNGE in my address to reply **
     
    Dan Wilga, Sep 20, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tobe
    Replies:
    1
    Views:
    293
    Steve C. Orr, MCSD
    Jul 8, 2003
  2. Razak
    Replies:
    3
    Views:
    1,215
    Razak
    Jul 19, 2004
  3. Larry Webb
    Replies:
    0
    Views:
    335
    Larry Webb
    Nov 17, 2005
  4. Axel
    Replies:
    8
    Views:
    1,220
    Adrienne Boswell
    Apr 27, 2009
  5. Naveen Dhanuka
    Replies:
    1
    Views:
    308
Loading...

Share This Page