help with Perl Mechanize

Discussion in 'Perl' started by zoewu, Feb 27, 2004.

  1. zoewu

    zoewu Guest

    Would anyone help me with this little script that I tried to get some
    contents from Yahoo Personals by using Perl Mechanize. It doesn't
    return any results, although I've feed all kinds of browser headers.
    Do I miss anything? Any comment is highly appreciated!!

    ------------------------------------


    #!/usr/bin/perl -w

    use WWW::Mechanize;
    use strict;

    my $mech=WWW::Mechanize->new();

    $mech->add_header(HTTP_ACCEPT => 'image/gif, '*/*');
    $mech->add_header(HTTP_ACCEPT_ENCODING => 'gzip, deflate');
    $mech->add_header(HTTP_ACCEPT_LANGUAGE => 'en-us');
    $mech->add_header(HTTP_CONNECTION => 'Keep-Alive');
    $mech->add_header(HTTP_USER_AGENT => 'Mozilla/4.0 (compatible; MSIE
    6.0; Windows NT 5.0; yie6; Q312461; .NET CLR 1.0.3705; .NET CLR
    1.1.4322)');
    $mech->add_header(REQUEST_METHOD => 'GET');
    $mech->add_header(Referer => 'http://personals.yahoo.com/');
    $mech->get("http://personals.yahoo.com/");
    $mech->success or die $mech->response->status_line;

    $mech->form_number(1);
    $mech->field('r_gender_pref' => "1");
    $mech->field('r_gender' => "2");
    $mech->field('r_min_age' => "25");
    $mech->field('r_max_age' => "35");
    $mech->field('csz' => "94011");
    $mech->submit();

    $mech->success or die "post failed:",$mech->response->status_line;

    print $mech->content();
    zoewu, Feb 27, 2004
    #1
    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. dpackwood
    Replies:
    3
    Views:
    1,773
  2. Neal Becker

    Help with mechanize

    Neal Becker, Aug 6, 2008, in forum: Python
    Replies:
    0
    Views:
    390
    Neal Becker
    Aug 6, 2008
  3. Xeno Campanoli
    Replies:
    1
    Views:
    332
    James Britt
    Jul 1, 2005
  4. Md.elme focruzzaman Shuvo

    Need Help in Aol Login with mechanize

    Md.elme focruzzaman Shuvo, Jun 17, 2007, in forum: Ruby
    Replies:
    0
    Views:
    130
    Md.elme focruzzaman Shuvo
    Jun 17, 2007
  5. bernice tsai

    help with Perl Mechanize

    bernice tsai, Feb 27, 2004, in forum: Perl Misc
    Replies:
    0
    Views:
    95
    bernice tsai
    Feb 27, 2004
Loading...

Share This Page